Join GitHub today
MySQL in some situations will generate spurious remove_constraint #251
Migrated issue, originally created by Johannes Erdfelt (@jerdfelt)
If a table includes a unique index with the same name as a column, the correct_for_autogen_constraints code for MySQL will remove it. This will cause the autogenerate code to generate a spurious remove_constraint.
The attached script reproduces the problem.
I have a patch and unit test that fixes the problem by ignoring unique indexes in correct_for_autogen_constraints since MySQL will never implicitly create a unique index.
Michael Bayer (@zzzeek) wrote:
MySQL: Ignore unique indexes when removing implicit indexes
MySQL will implicitly create indexes when using foreign keys. Alembic
However, unique indexes with the same name as a column are considered
Since MySQL will never implicitly create unique indexes, they can be
Johannes Erdfelt (@jerdfelt) wrote:
Thanks for the quick merge.
FWIW, I ran into this because of this unique index in Nova:
The recent fixes to alembic have made the autogenerate functionality much better.