Является ли хорошей практикой сброс всех миграций перед развертыванием проекта на сервере?
У меня есть два вопроса о лучших практиках развертывания, связанных с миграцией.
I am in the middle of developing a Django project. Sometimes I have to change some previous migrations due to some changes in one of my more previous models(like renaming a model to which other models have FK_ I know the solution but it is dirty and manual). sometimes it makes lots of conflicts.
I wonder "Is it really necessary to bother myself to resolve such conflicts when I am not at production When I can reset all migration by removing migration files and dropping SQLite DB?"
In development project contains many migrations which correct previous ones by changes to models(migration like rename, add a column ...). Isn't it better to reset all migrations and recreate all migrations first time I deploy the project to the server? I think why should create a table on the server with migrations that change models multiple times? Why shouldn't just deploy the final migrations?
Я не нашел ни одной документации по лучшим практикам. Большое спасибо, если вы поделитесь идеями и ссылками.
Я не уверен, что django публикует лучшие практики по миграциям, потому что всегда будет ответ "это зависит от ситуации".
Основываясь на своем опыте, когда ваш проект разработки готов, я рекомендую обнулить и воссоздать все миграции для проекта, чтобы вы могли начать с чистой и простой истории.
Есть также возможность squash migrations, хотя если история ошибочна или неактуальна, я не уверен, зачем вам нужна эта история в вашем проекте.