Answer the question
In order to leave comments, you need to log in
Is it possible to remove migrations and re-initialize in a running Django project?
Most likely a noob question, due to ignorance of how migrations work in Django.
There is a working project that is constantly being upgraded. Accordingly, the number of migration files grows. Is it possible without damaging the integrity of the database (Postgres) to delete current migrations and re-initialize them?
For example (but that's just the whole point), the 'django.contrib.sites' module was originally used, and the models contained ForeingKey fields on 'sites.Site', now wagtail has been attached to the project with its own multisite solution. Made models migration to 'wagtailcore.Site'. Everything is OK, but if you now remove 'django.contrib.sites' from INSTALLED_APPS, you need to change the first migrations, since they drag along the dependency on this module.
And a related question: if out of the box (or a ready-made battery) is it possible to clear all database tables that are not described in the code, except for pens?
That is, for example, remove the tables created by 'django.contrib.sites' since 'wagtailcore.Site' is now used.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question