New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"alembic current" wont show a head if it's a dependency in another branch #378

Closed
sqlalchemy-bot opened this Issue Jul 11, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jul 11, 2016

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

Create a1->a2->a3, and b1->b2, where b2 is dependent on a2:

#!

[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/4117fef4729e_a1.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "a2"
  Generating /home/classic/dev/alembic/tmp/bug/versions/4056b039cc5e_a2.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "a3"
  Generating /home/classic/dev/alembic/tmp/bug/versions/5bcdf4f57c00_a3.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b1" --head=base
  Generating /home/classic/dev/alembic/tmp/bug/versions/a87109c86005_b1.py ... done
[classic@photon2 tmp]$ python -m alembic.config revision -m "b2" --head=a87109c86005 --depends-on=4056b039cc5e
  Generating /home/classic/dev/alembic/tmp/bug/versions/e770df700933_b2.py ... done


upgrade to b2. We see that to satisfy b2, we also need a1 and a2, as well as b1 and b2:

#!

[classic@photon2 tmp]$ python -m alembic.config upgrade e770df700933
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 4117fef4729e, a1
INFO  [alembic.runtime.migration] Running upgrade 4117fef4729e -> 4056b039cc5e, a2
INFO  [alembic.runtime.migration] Running upgrade  -> a87109c86005, b1
INFO  [alembic.runtime.migration] Running upgrade a87109c86005 -> e770df700933, b2


"Current" should show us on a2 and b2, but because a2 is an ancestor of b2 via dependency, we don't see it:

#!

[classic@photon2 tmp]$ python -m alembic.config current
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
e770df700933 (head)

upgrading from a2 to a3, now we see the two branches again:

#!

[classic@photon2 tmp]$ python -m alembic.config upgrade 5bcdf4f57c00
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 4056b039cc5e -> 5bcdf4f57c00, a3


[classic@photon2 tmp]$ python -m alembic.config current
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
e770df700933 (head)
5bcdf4f57c00 (head)

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jul 12, 2016

Michael Bayer (@zzzeek) wrote:

Report on other branch dependencies in "current"

Fixed bug where the "alembic current" command wouldn't show a revision
as a current head if it were also a dependency of a version in a
different branch that's also applied. Extra logic is added to
extract "implied" versions on different branches from the top-level
versions listed in the alembic_version table.

Change-Id: I9f485fbc67555d13f737ecffdd25e4c0d8e33f1c
Fixes: #378

6d69285

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jul 12, 2016

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment