Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the command to force all migrations in Django?

I switched database names, and now my Django models are out of sync with my database tables. What is the command to force Django to perform all migrations to sync up the models and the tables? I don't want manage.py migrate --fake.

like image 731
book Avatar asked Feb 18 '16 20:02

book


1 Answers

I fixed this by manually deleting all the migrations and running makemigrations again to get a new initial migration file. Then, I went into my database and manually dropped all the tables that Django created in the app. Finally, I deleted all of the rows in the table django.migrations that included the app name. After all that, I ran manage.py migrate and the database was in sync.

like image 192
book Avatar answered Sep 21 '22 18:09

book