#32726: Enforce database level constraints for fields with limited choices
-------------------------------------+-------------------------------------
     Reporter:  Eerik Sven Puudist   |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  validation database  |             Triage Stage:
  constraints                        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => wontfix
 * needs_tests:  1 => 0


Comment:

 I agree with Nick, I don't think that any of these options should be built
 into Django.

 > use the enum datatype to declare acceptable choices

 This is already discussed in #24342.

 > add a CHECK constraint to the field which would ensure that the value
 falls into the range of acceptable choices
 > create an auxiliary table to store the acceptable choices and add a
 foreign key constraint to the field

 Both options are already available in Django, however I don't think any of
 them should be applied automatically, it's not worth extra complexity.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32726#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.8149631d05ef5a61dd55a090446cda9f%40djangoproject.com.

Reply via email to