[英]How do you cleanly maintain django migrations on non-master branch?
manage.py makemigrations --merge
, then it creates a new leaf that will later also be out of date. 如果我只是执行manage.py makemigrations --merge
,那么它会创建一个新的叶子,以后它也会过时。 Is there a nice way to handle this? 有一个很好的方法来处理这个? I'm tempted just to avoid having any migrations in long-lived dependent branches. 我很想避免在长期依赖的分支中进行任何迁移。
Unapply all migrations from the experimental branch: 从实验分支中取消应用所有迁移:
manage.py migrate <appname> <previousMigration>
Delete all migrations from the experimental branch. 从实验分支中删除所有迁移。
Create a brand new migration: 创建全新的迁移:
manage.py makemigrations
Commit changes to the experimental branch 提交对实验分支的更改
It's perfectly safe to delete migrations from a repository if no one else has applied them. 如果没有其他人应用迁移,那么从存储库中删除迁移是完全安全的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.