Django — How to automatically generate the structure of database tables from scratch, if it was adalina?
Django 1.9.7 - Removed the installation directory of the migration and the table in the database model. How to recover the table structure of the model? First do makemigrations then migrate, I get this error that table not found. Manually create? or is there an automated method? if so, what?
2 answers
clear table django_migrations
If You removed the module migrations, then Django will not follow the change of the schema models. Create this module again (migrations directory and an empty file __init__.py in it) and then run makemigrations
Find more questions by tags PostgreSQLDjango
even if you do not pomology nothing happened
remove the dump from the database
delete all tables
generate and roll migration
then restore only the working data from the required tables - Pear commented on July 8th 19 at 15:52
And if the case, the table django_migrations need to find unnecessary migration, the fields app name and delete them. - Letha_Kuhn commented on July 8th 19 at 15:55
now sense from django_migrations both from goat milk, because makemigrations will create quite a different sequence - Pear commented on July 8th 19 at 16:01
easier as said, to Bang, to roll the newly created migration and to fill the data from the dump - Pear commented on July 8th 19 at 16:07
Why remove from django_migrations all the records (which belong to django or even some applications to models) ?
Well, once again just in case: "... in the table django_migrations need to find unnecessary migration, the fields app name, and to remove them." - Letha_Kuhn commented on July 8th 19 at 16:10