]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
De-duplicate Revision.down_revision helpers.
authorSimon Bowly <simon.bowly@gmail.com>
Thu, 20 May 2021 21:46:04 +0000 (07:46 +1000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 21 May 2021 13:05:30 +0000 (09:05 -0400)
commit72235a2550c08eb7871576ce7b2283b111f796d2
treec1f178c21355e9dd49bcd21088fb920cf13ff5c2
parent8d5a9a1b0d32fff5726010afffa48cc0fb738238
De-duplicate Revision.down_revision helpers.

Fixes an issue when downgrading a revision where dependencies
are duplicated (e.g. by specifying the down_revision in depends_on).
This causes the down migrations to fail to remove the head, which is
caught by an assertion.

Added logic to de-duplicate the entries in _normalized_down_revisions
and _all_down_revisions without altering revision order.

This change revises the previous approach taken in
8d5a9a1b0d32fff5726010afffa48cc0fb738238 to address the problem
more generally outside of the topological algorithm.

Fixes: #843
Change-Id: I3517fb102b38c783c9a61bfb8dabc02c1fc89c4b
alembic/script/revision.py
tests/test_revision.py
tests/test_version_traversal.py