skip to Main Content

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


  1. Chosen as BEST ANSWER

    The app specific migrations in my case were not working.

    python manage.py makemigrations your_app_name
    python manage.py migrate your_app_name
    

    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 and migrate command. It is not a clever solution but it did the trick.


  2. You can do a particular app migration using below commands:

    python manage.py makemigrations your_app_name
    python manage.py migrate your_app_name
    

    This works for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search