Gent Bytyqi
Gent Bytyqi

Reputation: 419

Django migrate when model was previously deleted

When I do python manage.py migrate the desired model doesn't appear in my postgres database. I previously deleted all the tables and then migrated it again and it worked but I don't want that because I have loaded many data in the tables that I will have to load again. How to migrate only a certain model.

Upvotes: 1

Views: 31

Answers (1)

Cyrlop
Cyrlop

Reputation: 1984

You need to delete the migration files in app/migrations first and then run makemigrations before running migrate:

python manage.py makemigration

Also make sure to delete the corresponding lines in your django_migrations table.

Upvotes: 1

Related Questions