3👍
Your problem is that the migration failed, and MySQL does not have support for Transactions, so South doesn’t know in which state the tables are in.
The only way how you can recover it from this point is:
- Inspect the tables and check in which state of the migration they are (which columns changed etc)
- Backup both tables (Dump them out)
- Delete the tables.
- Recreate the tables using the migrate command.
- If the migration was not successful yet, use south to go the a state where the table matches the schema of your dumped-out data
- Import your dump
- Migrate again
0👍
Additional to Thomas’s answer; If you are getting any IntegrityError
for a key content_type_id
during the re-run of the migration, also remove the permissions that are created specifically for models of the application. The error would be similar to the following:
IntegrityError: (1062, "Duplicate entry '209-view_<model name>' for key 'content_type_id'")
In that case, remove these permissions from the table auth_permission. You can do a like
search for your models name to find all the permissions (view, add, change, remove).
Select * from auth_permission where codename like '%<model name>'
The command above will get you all the permission for your model, you can get their ID and delete (or simply write a join).
- [Django]-Weirdness with mongoengine ReferenceField
- [Django]-Django weighted query (annotated values)
- [Django]-How to add custom permission in viewset