Home > OS >  Django and pgAdmin not aligned
Django and pgAdmin not aligned

Time:12-17

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?

CodePudding user response:

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.

  • Related