more robust migrations
This commit is contained in:
@@ -32,7 +32,12 @@ def upgrade():
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
inspector = inspect(conn)
|
||||
columns = [col['name'] for col in inspector.get_columns('user')]
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_column('last_name')
|
||||
if 'last_name' in columns:
|
||||
batch_op.drop_column('last_name')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
Reference in New Issue
Block a user