</>
How to reset Django migrations during development
When using Django, sometimes you want to completely reset migrations before your applications hits production.
Django stores information about migrations on 2 places:
- In a DB, specifically in
django_migrations
table where it stores information about what migrations were applied. - In a filesystem, where migrations are basically defined.
Warning
Migrations are an important part of Django framework and you can only hard-delete them this way before you hit production.
In your database:
TRUNCATE django_migrations;
In your shell:
find . -path "*/migrations/*.py" -not -name "__init__.py" -deletefind . -path "*/migrations/*.pyc" -delete./manage.py run makemigrations./manage.py migrate --fake