add sid in snapshot_errors

This commit is contained in:
Cayo Puigdefabregas 2022-04-25 11:43:30 +02:00
parent 4ab692405f
commit 9b1e8617fa
1 changed files with 19 additions and 0 deletions

View File

@ -34,6 +34,15 @@ def upgrade_datas():
where wbid='{wbid}';""" where wbid='{wbid}';"""
con.execute(sql) con.execute(sql)
sql = f"select wbid from {get_inv()}.snapshot_errors;"
snapshots = con.execute(sql)
for snap in snapshots:
wbid = snap.wbid
if wbid:
sql = f"""update {get_inv()}.snapshot set sid='{wbid}'
where wbid='{wbid}';"""
con.execute(sql)
def upgrade(): def upgrade():
op.add_column( op.add_column(
@ -44,6 +53,16 @@ def upgrade():
upgrade_datas() upgrade_datas()
op.drop_column('snapshot', 'wbid', schema=f'{get_inv()}') op.drop_column('snapshot', 'wbid', schema=f'{get_inv()}')
op.add_column(
'snapshot_errors',
sa.Column('sid', citext.CIText(), nullable=True),
schema=f'{get_inv()}',
)
upgrade_datas()
op.drop_column('snapshot', 'wbid', schema=f'{get_inv()}')
op.drop_column('snapshot_errors', 'wbid', schema=f'{get_inv()}')
def downgrade(): def downgrade():
op.drop_column('snapshot', 'sid', schema=f'{get_inv()}') op.drop_column('snapshot', 'sid', schema=f'{get_inv()}')
op.drop_column('snapshot_errors', 'sid', schema=f'{get_inv()}')