Trap migration exceptions for the migration that we expect to fail in prod.
This commit is contained in:
parent
f5a16098fd
commit
2743fe6f4d
1 changed files with 13 additions and 6 deletions
|
@ -13,18 +13,25 @@ down_revision = '14fe12ade3df'
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.dialects import mysql
|
from sqlalchemy.dialects import mysql
|
||||||
|
from sqlalchemy.exc import InternalError
|
||||||
|
|
||||||
def upgrade(tables):
|
def upgrade(tables):
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_constraint(u'fk_logentry_access_token_id_accesstoken', 'logentry', type_='foreignkey')
|
try:
|
||||||
op.drop_index('logentry_access_token_id', table_name='logentry')
|
op.drop_constraint(u'fk_logentry_access_token_id_accesstoken', 'logentry', type_='foreignkey')
|
||||||
op.drop_column('logentry', 'access_token_id')
|
op.drop_index('logentry_access_token_id', table_name='logentry')
|
||||||
|
op.drop_column('logentry', 'access_token_id')
|
||||||
|
except InternalError:
|
||||||
|
pass
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade(tables):
|
def downgrade(tables):
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.add_column('logentry', sa.Column('access_token_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
|
try:
|
||||||
op.create_foreign_key(u'fk_logentry_access_token_id_accesstoken', 'logentry', 'accesstoken', ['access_token_id'], ['id'])
|
op.add_column('logentry', sa.Column('access_token_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
|
||||||
op.create_index('logentry_access_token_id', 'logentry', ['access_token_id'], unique=False)
|
op.create_foreign_key(u'fk_logentry_access_token_id_accesstoken', 'logentry', 'accesstoken', ['access_token_id'], ['id'])
|
||||||
|
op.create_index('logentry_access_token_id', 'logentry', ['access_token_id'], unique=False)
|
||||||
|
except InternalError:
|
||||||
|
pass
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
Reference in a new issue