nerv:quickbbs Benjamin$ manage.py migrate --run-syncdb
Running on nerv.local
Operations to perform:
Synchronize unmigrated apps: _humanize, allauth, bootstrap3, django_jinja, grappelli, humanize, messages, staticfiles
Apply all migrations: account, admin, auth, contenttypes, quickbbs, sessions, sites, socialaccount
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
No migrations to apply.
(quickbbs) nerv:quickbbs Benjamin$ python3 manage.py migrate
Running on nerv.local
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0019_auto_20171108_0155, 0044_auto_20180519_1914 in quickbbs).
To fix them run 'python manage.py makemigrations --merge'
(quickbbs) nerv:quickbbs Benjamin$
(quickbbs) nerv:quickbbs Benjamin$ python3 manage.py makemigrations --merge
Running on nerv.local
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 124, in handle
return self.handle_merge(loader, conflicts)
File "/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py", line 251, in handle_merge
raise ValueError("Could not find common ancestor of %s" % migration_names)
ValueError: Could not find common ancestor of {'0019_auto_20171108_0155', '0044_auto_20180519_1914'}
I have found several other people reporting similar issues, but I don't see any best practices to prevent this, and no straight forward explanations on how to fix this?
But my big question is why is this happening with Py3, and not Py2?
- Benjamin
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2403869.zZKC4CeI1l%40fritzbook.
For more options, visit https://groups.google.com/d/optout.
Not convinced yet this is a py2 versus py3 problem. First, you're running
different command flags (though, not sure it matters in this case). Second, the
Django version for py3 can be different from the py2 version.
From the backtrace it isn't clear though which app is causing this. If it
really is a py2 versus py3 issue, then I suspect that some migrations are done
only for py3, though that is really bad practice.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1555096.CvhEgTB1t9%40fritzbook.
> Okay, squashing seems to have resolved this issue...
Did you find any issues with the documentation on squashing?
migrate
, which is responsible for applying and unapplying migrations.makemigrations
, which is responsible for creating new migrations based on the changes you have made to your models.sqlmigrate
, which displays the SQL statements for a migration.showmigrations
, which lists a project’s migrations and their status.> Seems a bit voodoo-ish, but it worked. Any suggestions for preventing this
> in the future would be nice!
It's voodoo-ish cause you stopped analyzing the problem and went for the work-
around.
So my best guess is:
- The two 0018 migrations were caused by 2 different branches in the source repository, adding migrations in parallel
- These were applied to the database also in parallel
- Further migrations were added, depending on the 0018 migrations
- One migration was removed that was the common ancenstor for one of the 0018
migrations and another migration.
could have solved it.
To prevent it, establish a protocol for your developers to communicate with
eachother when adding and removing migrations.