Opened 5 years ago

Last modified 4 years ago

#31410 closed Cleanup/optimization

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

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

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 E102.

Change History (1)

by Marnanel Thurman, 5 years ago

Attachment: uniqueconstraint_bug.zip added

Demonstration

Note: See TracTickets for help on using tickets.
Back to Top