Skip to content
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

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

Closed
sqlalchemy-bot opened this issue Jul 12, 2016 · 3 comments
Labels
bug Something isn't working versioning model
Milestone

Comments

@sqlalchemy-bot
Copy link

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.

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • edited description

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Don't remove dependent version when downgrading to a version.

Adjusted the version traversal on downgrade
such that we can downgrade to a version that is a dependency for
a version in a different branch, without needing to remove that
dependent version as well. Previously, the target version would be
seen as a "merge point" for it's normal up-revision as well as the
dependency. This integrates with the changes for 🎫377
and 🎫378 to improve treatment of branches with dependencies
overall.

Change-Id: Ica0732f6419f68ab85650170839ac8000ba3bbfb
Fixes: #379

ca84906

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added versioning model bug Something isn't working labels Nov 27, 2018
@sqlalchemy-bot sqlalchemy-bot added this to the fasttrack milestone Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working versioning model
Projects
None yet
Development

No branches or pull requests

1 participant