[Fixed]-Django addField ForeignKey during migrations create unusable constraint name

1👍

The problem was the attribute name (but I still dunno why):

zps_calculated = models.ForeignKey( Carto…

I renamed it to

zpsasd_calculated = models.ForeignKey( Carto

and the generated constraint name changed to (sqlmigrate):
a326518e5e22b0c2c1251e5bbb331adb

Wow!

Renamed the attribute zpsasd_calculated to zps_calculated, with another migration.

Worked.

Next time I will migrate with custom SQL
https://www.ralphlepore.net/custom-foreign-key-constraints-with-django/

Leave a comment