fix(database): upgrade error in pg database

Co-Authored-By: Aqr-K <95741669+Aqr-K@users.noreply.github.com>
This commit is contained in:
DDSRem
2025-08-23 18:12:13 +08:00
co-authored by Aqr-K
parent e90359eb08
commit cb1dd9f17d
10 changed files with 143 additions and 57 deletions
+7 -8
View File
@@ -18,19 +18,18 @@ depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with contextlib.suppress(Exception):
# 添加触发类型字段
conn = op.get_bind()
inspector = sa.inspect(conn)
columns = inspector.get_columns('workflow')
if not any(c['name'] == 'trigger_type' for c in columns):
op.add_column('workflow', sa.Column('trigger_type', sa.String(), nullable=True, default='timer'))
with contextlib.suppress(Exception):
# 添加事件类型字段
if not any(c['name'] == 'event_type' for c in columns):
op.add_column('workflow', sa.Column('event_type', sa.String(), nullable=True))
with contextlib.suppress(Exception):
# 添加事件条件字段
if not any(c['name'] == 'event_conditions' for c in columns):
op.add_column('workflow', sa.Column('event_conditions', sa.JSON(), nullable=True, default={}))
# ### end Alembic commands ###
def downgrade() -> None: