Rollback the migration, delete all migration scripts, and then redo the schema migrations.
※ To migrate to zero, all records in the database will be deleted.
Bash script
recreate-migration(){ if [ "$1" ]; then ./manage.py migrate $1 zero rm $1/migrations/00??_*.py* ./manage.py schemamigration $1 --initial ./manage.py migrate $1 else echo "usage: recreate-migration <app-name>" fi }
Comments