How to simplify migrations in Django 1.7?
I got this. I just figured this out and it is good.
First, to clear migrations table:
./manage.py migrate --fake <app-name> zero
Remove
app-name/migrations/
folder or contents.Make the migrations:
./manage.py makemigrations <app-name>
Finally tidy up your migrations without making other database changes:
./manage.py migrate --fake <app-name>
In the Django 1.7 version of migrations the reset functionality that used to be in South has been dropped in favor of new functionality for 'squashing' your migrations. This is supposed to be a good way to keep the number of migrations in check.
https://docs.djangoproject.com/en/dev/topics/migrations/#squashing-migrations
If you still want to really start from scratch i assume you still could by emptying the migrations table and removing the migrations after which you would run makemigrations
again.
I just had the same problem.Here's my workaround.
#!/bin/shecho "Starting ..."echo ">> Deleting old migrations"find . -path "*/migrations/*.py" -not -name "__init__.py" -deletefind . -path "*/migrations/*.pyc" -delete# Optionalecho ">> Deleting database"find . -name "db.sqlite3" -deleteecho ">> Running manage.py makemigrations"python manage.py makemigrationsecho ">> Running manage.py migrate"python manage.py migrateecho ">> Done"
The find
command: http://unixhelp.ed.ac.uk/CGI/man-cgi?find