Reputation: 24731
I have 4 models. I want to redo 1 one of them that I've been working on. The other 3 models have user data that I don't want to lose.
I want to entirely drop one table, and sync it up with what's in models.py.
How do I do this?
Upvotes: 1
Views: 357
Reputation: 308779
You could remove the model from models.py
, and create a migration which will drop the table.
./manage.py makemigrations
Then add the model back to your models.py
, and create a new migration which will recreate the model.
./manage.py makemigrations
Finally, run your migrations and you should be done.
./manage.py migrate
Upvotes: 4
Reputation: 2384
It's not very clear what you want to do here.
You can write new model class and delete old model class that you want to remove. After that run migrations the normal way. It will delete the table related to deleted model class and make whatever othe changes you have defined in the models.
Upvotes: 1