(Postgres and MySQL Answer)
If you look at your actual table (use \d table_name
) and look at the indexes, you’ll find an entry for your unique constraint. This is what Django is trying to find and drop. But it can’t find an exact match.
For example,
"table_name_...6cf2a9c6e98cbd0d_uniq" UNIQUE CONSTRAINT, btree (d, a, b, c)
In my case, the order of the keys (d, a, b, c)
did not match the constraint it was looking to drop (a, b, c, d)
.
I went back into my migration history and changed the original AlterUniqueTogether
to match the actual order in the database.
The migration then completed successfully.