Home > Net >  Deleting migration folder "No migrations to apply"
Deleting migration folder "No migrations to apply"

Time:06-17

I have deleted migration folder because I have an issue which can't to solve. After that I try to migrate, but it wrotes me "No migrations to apply". enter image description here

So, I don't understand why it wrote me this message, when I don't migrate these files.

CodePudding user response:

Command python manage.py migrate seeks the migration files and then try to rebuild database according to that files. If you have deleted those files there is nothing to read/compare.

If you have deleted those files you might need to drop database and create new one unless you try makemigrations. But probably it will raise some errors if you made some important changes in model structures.

CodePudding user response:

Run this command

   python manage.py showmigrations

This migration looks like [X] 0001_migration_filename.py [X] which means migration is not deleted. so you need to delete migration from the database as well. if you are using sqllite3(by default database) then delete the .sql file or if you are using PostgreSQL or any other database then delete the migration file from the django_migration database.

  • Related