Django migration can not find existing constraint
|Patch needs improvement:
I've a project with long history. The databases were originally migrated by South and then it has moved to Django migrations.
Now when I've made changes to unique_together constraint, I got migration failure:
ValueError: Found wrong number (0) of constraints for trans_check(contentsum, project_id, language_id, check)
This seems to be caused by the constraing being created in different order in past. I think it has been created by South, but I'm not 100% sure. But anyway I've ended up with half applied migration what is not really a pleasant state.
I've fixed this for me by comparing fields as set not as lists (see attached patch), what is certainly okay for unique constraints, but is probably bad idea for general indexes.