Django продолжает выполнять повторные миграции для моего приложения. Я пробежал makemigrations
и migrate
до того, как сменил модель. После изменений я снова запустил makemigrations
, чтобы выполнить миграции для обновленной модели, я получил следующую ошибку:
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0001_initial, 0001_initial 3 in sessions; 0002_remove_content_type_name 3, 0002_remove_content_type_name, 0001_initial 3 in contenttypes; 0002_alter_permission_name_max_length 3, 0010_alter_group_name_max_length 3, 0007_alter_validators_add_error_messages 3, 0006_require_contenttypes_0002 3, 0005_alter_user_last_login_null 3, 0001_initial 3, 0008_alter_user_username_max_length 3, 0009_alter_user_last_name_max_length 3, 0011_update_proxy_permissions, 0011_update_proxy_permissions 3, 0004_alter_user_username_opts 3, 0003_alter_user_email_max_length 3 in auth; 0003_logentry_add_action_flag_choices 3, 0002_logentry_remove_auto_add 3, 0003_logentry_add_action_flag_choices, 0001_initial 3 in admin).
Чтобы исправить их, запустите 'python manage.py makemigrations --merge'
Запуск makemigrations --merge
не работает: ValueError: Could not find common ancestor of {'0002_remove_content_type_name', '0002_remove_content_type_name 3', '0001_initial 3'}
В приложениях есть много повторяющихся миграций, которых я не коснулся (auth, admin, et c.):
admin
[ ] 0001_initial 3
[X] 0001_initial
[ ] 0002_logentry_remove_auto_add 3
[X] 0002_logentry_remove_auto_add
[X] 0003_logentry_add_action_flag_choices
[ ] 0003_logentry_add_action_flag_choices 3
auth
[ ] 0001_initial 3
[X] 0001_initial
[ ] 0002_alter_permission_name_max_length 3
[X] 0002_alter_permission_name_max_length
[ ] 0003_alter_user_email_max_length 3
[X] 0003_alter_user_email_max_length
[ ] 0004_alter_user_username_opts 3
[X] 0004_alter_user_username_opts
[ ] 0005_alter_user_last_login_null 3
[X] 0005_alter_user_last_login_null
[ ] 0006_require_contenttypes_0002 3
[X] 0006_require_contenttypes_0002
[ ] 0007_alter_validators_add_error_messages 3
[X] 0007_alter_validators_add_error_messages
[ ] 0008_alter_user_username_max_length 3
[X] 0008_alter_user_username_max_length
[ ] 0009_alter_user_last_name_max_length 3
[X] 0009_alter_user_last_name_max_length
[ ] 0010_alter_group_name_max_length 3
[X] 0010_alter_group_name_max_length
[X] 0011_update_proxy_permissions
[ ] 0011_update_proxy_permissions 3
contenttypes
[ ] 0001_initial 3
[X] 0001_initial
[X] 0002_remove_content_type_name
[ ] 0002_remove_content_type_name 3
database
(no migrations)
sessions
[X] 0001_initial
[ ] 0001_initial 3
Единственное приложение, которое, насколько я знаю, должно было быть затронуто, это database
. Почему Django делает эти двойные миграции? Есть ли способ, которым я могу избавиться от них? Или применить их, чтобы они больше не блокировали? Как я могу убедиться, что это больше не повторится?