'Not able to migrate changes to mysql database from Django
I have added foreign keys to some of the models in a Django application but the changes are not being reflected in the MySQL database even after migrating them. I have tried deleting all the previous migrations and then redoing but had no success. What could be the issue here?
Solution 1:[1]
that could have many reasons which i need more details to say exact answer, but i can say my previous experiences that solved migrations error. first if you want to do migrations again you should delete all tables plus your migrations files ( IMPORTANT NOTE: you should not delete migrations folder and you should not delete __ init __.py file in migrations folder which make migrations folder a module if you deleted it just make an empty one yourself) and sometimes because of an error in your models, your migrations does not completely migrate so if you migrate again it say some tables are duplicated so you should fix the errors and bugs, delete all tables and migrations like i just said and migrate again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | babak gholamirad |