B
B
Bjornie2017-09-24 20:49:42
Django
Bjornie, 2017-09-24 20:49:42

What to do with all migrations?

The question is about the numerous migration files that were created during the development process. At the moment, the project has been finalized to the desired state and I don’t understand why I might need old migrations that do not reflect the current state of the models. Can I safely remove them? Can I need them for some reason?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2017-09-24
@Bjornie

The squashmigrations command will help you compress them into one.

S
Stepan Krapivin, 2017-09-24
@xevin

If there are no migrations anywhere else except your computer, and you will upload an already finished project to production, then you can safely get rid of migrations.
Migrations are most often needed when the project is running in production, at which time development is underway on a test server and a couple of developers. Someone alone changes the model and it is necessary that the rest also work as it should. This is where migration comes in handy. Everyone will just download the migrations, migrate and keep working.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question