Django迁移依赖项引用不存在的父节点

Gui*_* IA 1 migration django dependencies not-exists ancestor

我有django迁移的问题.我收到此错误:

django.db.migrations.exceptions.NodeNotFoundError: Migration user.0050_merge_20170523_1254 dependencies reference nonexistent parent node ('user', '0049_auto_20170519_1934')
Run Code Online (Sandbox Code Playgroud)

我修复错误,删除一些行,但在修复所有这些错误后,我得到其他:

ValueError: Could not find common ancestor of {'0050_merge_20170523_1254', '0007_auto_20170524_1540'}
Run Code Online (Sandbox Code Playgroud)

我无法解决这个问题.我可以删除数据库并再次makemigrations ...但在生产环境中我想知道如何正确修复,没有drop database哈哈.

谢谢!

han*_*anz 5

下次回滚时:

  1. 进入应用中的迁移文件夹.
  2. 查找要返回的迁移文件.(例如"0012_post_category.py")
  3. 进入终端写:( ./manage.py migrate yourAppName 0012这只是示例号)并按Enter键
  4. 如果一切顺利的话.删除迁移文件夹中此号码后面的其他迁移.

不要只是删除迁移!希望有所帮助.