Skip to content

downgrade to a version that's a cross-branch dependency forces the branch to downgrade #379

@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Michael Bayer (@zzzeek)

Lets build this:

#!

a1 -> a2 -> a3
       ^
       |
       +----+
            |
b1 -> b2 -> b3 -> b4

#!


[classic@photon2 tmp]$ python -m alembic.config init bug
  Creating directory /home/classic/dev/alembic/tmp/bug ... done
  Creating directory /home/classic/dev/alembic/tmp/bug/versions ... done
  Generating /home/classic/dev/alembic/tmp/bug/README ... done
  Generating /home/classic/dev/alembic/tmp/bug/script.py.mako ... done
  Generating /home/classic/dev/alembic/tmp/alembic.ini ... done
  Generating /home/classic/dev/alembic/tmp/bug/env.py ... done
  Please edit configuration/connection/logging settings in '/home/classic/dev/alembic/tmp/alembic.ini' before proceeding.
[classic@photon2 tmp]$ python -m alembic.config revision -m "a1"
  Generating /home/classic/dev/alembic/tmp/bug/versions/e3659cc5c8f0_a1.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "a2"
  Generating /home/classic/dev/alembic/tmp/bug/versions/e429b4a0d347_a2.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "a3"
  Generating /home/classic/dev/alembic/tmp/bug/versions/aa1788c001d4_a3.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b1" --head="base"
  Generating /home/classic/dev/alembic/tmp/bug/versions/70bb2ff17906_b1.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b2" --head=70b
  Generating /home/classic/dev/alembic/tmp/bug/versions/0d4fdbc6d7bf_b2.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b3" --head=0d4 --depends-on=e429
  Generating /home/classic/dev/alembic/tmp/bug/versions/72b2398778e8_b3.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b4" --head=72b2
  Generating /home/classic/dev/alembic/tmp/bug/versions/677fdb99c800_b4.py ... done

after upgrading to heads, we want to do a downgrade to a2. a2 is a depedency of b3.

#!


[classic@photon2 tmp]$ python -m alembic.config downgrade e429
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running downgrade aa1788c001d4 -> e429b4a0d347, a3
INFO  [alembic.runtime.migration] Running downgrade 677fdb99c800 -> 72b2398778e8, b4
INFO  [alembic.runtime.migration] Running downgrade 72b2398778e8 -> 0d4fdbc6d7bf, e429b4a0d347, b3

So now we are on "a2", but in doing so, it downgraded b3 as well! there's no reason to downgrade b3, its dependency a2 is still there. The reason this happens is because it's treated as an unmerge point, which in reality, it's not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions