Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django migration No migrations to apply

I have screwed up my database so I tried to redo it. I did:

1) deleted all tables via sql

2) deleted the migrations folder

So when I now do manage.py makemigrations myapp it is creating the migration folder and the initial.py file, which looks fine. Also the __init__.py is there. However, if i do manage.py makemigrations myapp I always get the message "No migrations to apply."

I looked up the database in the shell and the tables are not there.

I am using Django 1.8.

like image 234
ger.s.brett Avatar asked Nov 05 '15 16:11

ger.s.brett


Video Answer


1 Answers

Django keeps track of all the applied migrations in django_migrations table. So just delete all the rows in the django_migrations table that are related to you app like:

DELETE FROM django_migrations WHERE app='your-app-name';

and then do:

python manage.py makemigrations
python manage.py migrate
like image 61
Anush Devendra Avatar answered Oct 06 '22 22:10

Anush Devendra