I've created a CompositeForeignKey constraint derived from Django's new 
BaseConstraint.  It requires that I manually make a unique_together in any 
of the referenced models views due to the DB internal requirements of 
composite foreign keys.

It mostly works -- except that when the operations are defined in the 
migration, the order is critical -- the unique_together's need to be made 
before the composite key SQL.

For now, I just went in and manually changed the order of operations in the 
migration to put the CompositeForeignKeys last.   Another way around would 
be to comment out all the CompositeForeignKey declarations in my models, 
migrate my unique_together's first, and then re-add the 
CompositeForeignKeys.

...I'm wondering if there is a supported way to hook into the migration 
creation process, give priorities to certain kinds of constraints, and then 
sort the operations by this priority before they are emitted into a 
migration.py.

Or any other ideas to make this a bit more seamless?

Rich

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c5c30972-c5cb-402f-b88b-a072bb284318%40googlegroups.com.

Reply via email to