#31650: Documentation does not mention that constraint names must be unique per
database
-----------------------------------------+------------------------
               Reporter:  Hanne Moa      |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Documentation  |        Version:  3.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 When using `unique_together`, Django will create a unique name for you.

 What I have seen with inexperienced people using Django 2.2 and newer is
 that when they use `UniqueConstraint`instead of `unique_together` they
 build up a name from the fields involved and maybe the word "unique". So,
 when they have two different models with the same fields needing to be in
 a unique constraint, they end up with the same name, and hence sooner or
 later an error.

 It should be mentioned in the documentation whenever
 '''*Constraint.name''' is mentioned that the name needs to be unique for
 the database, and for 3.0 the example should be updated to include
 `%(app_label)s` or at a minimum `%(class)s`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31650>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.074c937d8748aad53ac99c2bbebbd8f1%40djangoproject.com.

Reply via email to