Django runserver
complains:
You have unapplied migrations;
your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
How can I find out which migrations are unapplied without running migrate?
You have unapplied migrations; your app may not work properly until they are applied. Run 'python manage.py migrate' to apply them. How can I find out which migrations are unapplied without running migrate? One way to do this is to look at the django_migrations table in the DB and check which ones are applied.
Yes, you can just delete them from migrations folder (dont delete the migrations folder itself).
If you're on 1.7, use python manage.py migrate --list
. (docs)
If you're on 1.8 or above, use python manage.py showmigrations --list
. (docs)
In either case, there will be an [X] to show which migrations have been applied.
A minor modification on Kevin's answer using grep, to only show unapplied migrations:
Django 1.7:
python manage.py migrate --list | grep -v '\[X\]'
Django 1.8 and above:
python manage.py showmigrations --list | grep -v '\[X\]'
Edited after ngoue's comment. Nice catch. Thanks for pointing it out.
You can see a list of just the unapplied migrations with the --plan
option of the migrate
command:
python manage.py migrate --plan
It was introduced in Django 2.2 and is documented here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With