Django – How to Clear All Migrations and Re-migrate

During your website development with Django, you will find yourself changing your models and migrating these changes to your database. Sometimes this will happen too often and you will encounter problems creating/applying your migrations. On some occasions you will feel the need to reset/clear all your migrations and re-create/re-apply them.

Below are the steps to clear all your Django migrations and re-migrate:

1- Delete everything in application’s “migrations” folder except for __init__.py
2- DELETE FROM django_migrations WHERE app = ‘app_name’;
3- Drop all tables associated with ‘app_name’.
4- Run makemigrations
5- Run migrate

Hope this helps.
Good Luck,
Serdar

Serdar Osman Onur
I love coding web stuff, learning/applying new technologies and techniques to create things on the internet since 2004. AboutMe G+ twitter
Serdar Osman Onur

@serdarosmanonur

hard work, determination, dedication, patience, consistency, faith
"We forge our bodies in the fire of our will" - Enter the Dragon - 1973 - 3 days ago
Serdar Osman Onur

One thought on “Django – How to Clear All Migrations and Re-migrate

Comments are closed.