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

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

Comments are closed.