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?
July 8th 19 at 15:41
2 answers
July 8th 19 at 15:43
Solution
clear table django_migrations
Cleared, then do a makemigrations, then migrate, I get this error: relation "django_content_type" already exists. migrate --fake to succeed. but in admin.panel: LINE 1: SELECT COUNT(*) AS "__count" FROM "%table model%". - melvin9 commented on July 8th 19 at 15:46
to clean out the entire database? Without this in any way? - melvin9 commented on July 8th 19 at 15:49
django_content_type you can remove can any more service for the migration experiment is

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
"to clear the table django_migrations" - it's like that broken nail and amputated arm)))
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
In General, migration to and need to in a database or what not to delete, only edit. - Letha_Kuhn commented on July 8th 19 at 15:58
were removed directory migrations
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
: directory removed, but why all the records from django_migrations banging? - Letha_Kuhn commented on July 8th 19 at 16:04
then the notes were associated with the old migrations that such as were not generatsya

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
: I wrote the above, but will repeat just in case: ""to clear the table django_migrations" - it's like that broken nail and amputated arm)))"
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
July 8th 19 at 15:45
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