django,壁球迁移,循环依赖太多

django, squash migrations, too many circular dependencies

我试图压缩迁移。

不幸的是,循环依赖太多了。

有没有一种方法可以重新开始迁移(尽管我的项目已经部署在生产环境中)而不是尝试压缩迁移?

我不必担心一些不知名的开发者使用我的项目,因为它是一个私人项目。

是的,有办法。参见 。简而言之:

# 1) Fake migrations back to 0
./manage.py migrate app zero --fake

# 2) Delete migrations files
git rm "app/migrations/*"

# 3) Create new migration file
./manage.py makemigrations app

# 4) Pretend to run the new migration
./manage.py migrate app --fake