Monday, May 8, 2017

Re: OperationalError:no such table

On Sunday 07 May 2017 03:54:39 hamza bouissi wrote:

> after I add new model and delete all other models and their migration

> files

 

You still have a reference to one of the deleted models in your urls or a view that is referenced by that url.

 

Also, this isn't the way to do it.

First make a migration for the removed models, then add the new model and it's migration. Then run squashmigrations, start at the first migration and end with the last.

In theory you should be left with only 1 operation, the one that creates the new model.

If you then run migrate, the database will be migrated correctly using all individual migrations but new installs will only use the squashed migration.

 

--

Melvyn Sopacua

No comments:

Post a Comment