Opened 5 years ago

Last modified 4 years ago

#31410 closed Cleanup/optimization

makemigrations doesn't check that UniqueConstraint field names exist — at Version 2

Reported by: Marnanel Thurman Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Ian Foote Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Marnanel Thurman)

When a model gains a UniqueConstraint, makemigrations doesn't check that the fields named therein actually exist.

This is in contrast to the older unique_together syntax, which raises models.E012 if the fields don't exist.

In the attached demonstration, you'll need to uncomment "with_unique_together" in settings.py in order to show that unique_together raises E012.

Change History (3)

by Marnanel Thurman, 5 years ago

Attachment: uniqueconstraint_bug.zip added

Demonstration

comment:1 by Marnanel Thurman, 5 years ago

Component: UncategorizedMigrations

comment:2 by Marnanel Thurman, 5 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top