Wednesday 25 May 2022

Django re-run migrations

https://stackoverflow.com/questions/32123477/how-to-revert-the-last-migration 

python manage.py showmigrations

python manage.py migrate {app name from show migrations} {00##_migration file.py}

If you want to revert all migrations, use zero as the name of the migration:

python manage.py migrate app_name_here zero


Delete the migration file. Once the desired migration is in your models...

python manage.py makemigrations
python manage.py migrate

No comments:

Post a Comment