#27910: Allow using an Enum class in model Field choices
-------------------------------------+-------------------------------------
     Reporter:  Marcel Hellwig       |                    Owner:  Shai
                                     |  Berger
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  enum model choices   |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 > This ticket really ought to consider the use of database level enums for
 the field. (e.g. ​https://www.postgresql.org/docs/9.1/datatype-enum.html
 ). They provide a lot of efficiency (storage and searching), while
 allowing the DB to contain human readable values (from the point of view
 of anyone querying it), and also having tight data integrity - you get the
 best of everything. MySQL also has support, but it looks a bit different.

 Just wanted to drop a note to mention that PostgreSQL's enum type doesn't
 support value removal (as of 11) and that MySQL stores enum as tinyint
 index of the values so if you perform an ordering change you pretty much
 corrupt your column. The index based value on MySQL poses notable problems
 when joining similar values across tables
 [https://dev.mysql.com/doc/refman/5.7/en/enum.html or ordering by such a
 column]. I believe these two reasons make uses database level enums in a
 database agnostic way really challenging.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/27910#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.96b982e8be6eb517a58551b90aa58abc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to