I was trying to change the order of the table columns in a postgreSQL table. As I am just starting, it seemed easier to manage.py flush
and create a new DB with new name and apply migrations.
I can see the new DB in pgAdmin received all the Django models migrations except my app model/table. I deleted all migrations folder (except 0001_initial.py
) and still, when I run python manage.py makemigrations
I get:
No changes detected
But the model class table is not in the DB. When I try to migrate the app model it says:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
Is there any way to delete all tables, makemigrations
and migrate
and postgres get all the tables? Any idea why postgreSQL/pgAdmin cannot get my Django app model/table?
2
Answers
The app specific migrations in my case were not working.
What did the trick is to modify the models adding an additional fake variable, then all the variables (and not only the additional one) gets picked up by the
makemigrations
andmigrate
command. It is not a clever solution but it did the trick.You can do a particular app migration using below commands:
This works for me.