Hallo, we are using Alembic in a rather big project with various database revisions and stumbled over a problem with diamond-shaped branch-merges.
We have the following diamond-shaped dependency tree with three branches: 1. "master" Branch 2. "addon 1" branch 3. "addon 2" branch The graph looks as follows: | | | | a | | . | . | | . | . | |. | .| x1 | y1 |. | .| | . | . | | . | . | | b | | | | | | | x2 c y2 Straight lines represent down_revision and dotted lines mean depends_on relationships. The addon branches should not be merged into the master branch. Hence, we use the depends_on directive as described in the Alembic docs Branch Dependencies <http://alembic.zzzcomputing.com/en/latest/branches.html#branch-dependencies>.We have various constructs of this shape in our dependency graph. If we run alembic upgrade heads, we get an KeyError when applying the "Merge" migration: File "/home/lucas/dev/torql/api/torql/migrations/env.py", line 115, in <module> run_migrations_online() File "/home/lucas/dev/torql/api/torql/migrations/env.py", line 109, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/home/lucas/dev/torql/.venv/lib/python3.6/site-packages/alembic/runtime/environment.py", line 797, in run_migrations self.get_context().run_migrations(**kw) File "/home/lucas/dev/torql/.venv/lib/python3.6/site-packages/alembic/runtime/migration.py", line 319, in run_migrations head_maintainer.update_to_step(step) File "/home/lucas/dev/torql/.venv/lib/python3.6/site-packages/alembic/runtime/migration.py", line 486, in update_to_step self._delete_version(delrev) File "/home/lucas/dev/torql/.venv/lib/python3.6/site-packages/alembic/runtime/migration.py", line 437, in _delete_version self.heads.remove(version) KeyError: 'a' Alembic cannot delete the branchpoint revision because it is not included in the heads set of the alembic.runtime.migration.HeadMaintainer instance. The problem can be solved by inserting a "Noop" revision between the Branch- and Mergepoint: | | | | a | | . | . | | . | . | |. | .| x1 noop y1 |. | .| | . | . | | . | . | | b | | | | | | | x2 c y2 Can someone explain the problem to us or is this a bug in Alembic? -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.