S
S
Stanislav Shabalin2021-04-05 16:46:33
Django
Stanislav Shabalin, 2021-04-05 16:46:33

How to recreate migrations in Django for an application without resetting all data?

After an unsuccessful experiment, I lost the folder with migrations from the main application in production.
For additional applications (those that created after the main one), all migrations are correct.
I had to manually set up some tables, including relations, using phpmyadmin.

All that we managed to do now is to create an initial migration:

<b>python manage.py makemigrations exhibition</b>
Migrations for 'exhibition':
  exhibition/migrations/<b>0001_initial.py</b>
...


After any command gives an error - it's understandable
<b>python manage.py migrate exhibition --fake</b>

...
<i>Migration rating.0001_initial is applied before its dependency exhibition.0001_initial on database 'default'</i>


Is there any experience of creating migrations in my case and will deleting migrations for all then applications and re-command help
python manage.py makemigrations
?

PS DBMS: mysql, a hosted product, there are already a huge number of entries in the application tables

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2021-04-05
@Starck43

https://simpleisbetterthancomplex.com/tutorial/201...
PS Well, nothing prevents you from trying it at a neighboring base

S
Stanislav Shabalin, 2021-04-05
@Starck43

In general, everything worked out, I created migrations in turn, and then applied them as fake ones. Thanks dimonchik2013

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question