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

MigrationContext.stamp missing call to _ensure_version_table? #300

Closed
sqlalchemy-bot opened this Issue Jun 9, 2015 · 4 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jun 9, 2015

Migrated issue, originally created by Christian Theune (@ctheune)

Hi!

I'm currently upgrading from an older version where I used the following code when stamp() did not exist yet:

migration_context._update_current_rev(
migration_context.get_current_revision(), script.get_current_head())

This code was fine to call directly after create_all() and the new documentation says that one should use command.stamp. In my situation I do not have a manifested config file to use the Configuration object with and I think I should be able to just call

migration_context.stamp(script, "head")

This fails for new databases because the initial version table does not get created. I see that the MigrationContext class has _ensure_version_table() which is used except in stamp(). This looks like an accident to me.

Christian

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 9, 2015

Michael Bayer (@zzzeek) wrote:

ah OK the docs have "command.stamp()", so this isn't broken for the world at least.

yeah migration_context.stamp() was added in 0.7.0 with the versioning refactor. im not sure if there was a reason that this was omitted from that, let me see.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 9, 2015

Michael Bayer (@zzzeek) wrote:

  • The :meth:.MigrationContext.stamp method, added as part of the
    versioning refactor in 0.7 as a more granular version of
    :func:.command.stamp, now includes the "create the alembic_version
    table if not present" step in the same way as the command version,
    which was previously omitted.
    fixes #300

541cbd2

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 9, 2015

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jun 9, 2015

Michael Bayer (@zzzeek) wrote:

nothing broke so we are good, thanks for reporting!

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