Skip to content

Commit

Permalink
fix(database): 数据库已经升级CONFIG_SYNC_PATHS到支持Location字段版本后,每次升级仍然尝试插入Loc…
Browse files Browse the repository at this point in the history
…ation字段导致报错
  • Loading branch information
xuyanling committed Sep 19, 2023
1 parent 36ea822 commit 0d7e58a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/versions/ff1b04a637f8_1_3_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@

def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('CONFIG_SYNC_PATHS', sa.Column('LOCATING', sa.Integer(), nullable=True))
try:
with op.batch_alter_table('CONFIG_SYNC_PATHS') as batch_op:
if not batch_op.has_column('LOCATING'):
batch_op.add_column(sa.Column('LOCATING', sa.Integer(), nullable=True))
except Exception as e:
pass
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('CONFIG_SYNC_PATHS', 'LOCATING')
pass
# ### end Alembic commands ###

0 comments on commit 0d7e58a

Please sign in to comment.