V
V
Vladimir2018-10-23 14:56:52
Django
Vladimir, 2018-10-23 14:56:52

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

1 answer(s)
S
sim3x, 2018-10-23
@FonVald

https://docs.djangoproject.com/en/2.1/topics/migra...
https://stackoverflow.com/a/6485171

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question