Issue
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.
Solution
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
Answered By - Anush Devendra
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.