Issue
There are two models Groups and Students and only one table for Groups of them, the Students table was deleted.
How to make Django recreate the deleted table? If I do makemigrations
it prints "No changes detected".
On admin page when I click on the Students table it throws an exception:
relation "students_students" does not exist
Solution
In django 1.7 you can try:
1. Delete your migrations folder
2. In the database: DELETE FROM django_migrations WHERE app = 'app_name'.
You could alternatively just truncate this table.
3. python manage.py makemigrations
4. python manage.py migrate --fake
If you are working in django 1.9.5 this is the 100 % solution for this problem:
1. Delete your migrations folder
2. In the database: DELETE FROM django_migrations WHERE app = 'app_name'.
You could alternatively just truncate this table.
3. python manage.py makemigrations app_name
4. python manage.py migrate
This works 100% for me!
Answered By - Raúl EL
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.