Skip to content

Adding a command of verification before upgrading or downgrading #1513

Closed Answered by zzzeek
nevcohen asked this question in Usage Questions
Discussion options

You must be logged in to vote

sounds good, alembic supports that, add it to your script.py.mako template and your migration files will be generated with that format. you can break upgrade into two separate calls like this



def verification_before_upgrade():
    pass

def upgrade():
    verification_before_upgrade()
    do_upgrade()

def do_upgrade():
    ${upgrades if upgrades else "pass"}


def verification_before_downgrade():
    pass

def downgrade():
     verification_before_downgrade()
     do_downgrade()

def do_downgrade():
    ${downgrades if downgrades else "pass"}


Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nevcohen
Comment options

Answer selected by nevcohen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants