fix: make migration 0020 idempotent (check column exists)

This commit is contained in:
Agent Zero
2026-07-17 00:59:41 +02:00
parent 4a461f4a72
commit 0774fc4407
@@ -15,15 +15,23 @@ depends_on = None
def upgrade() -> None:
op.add_column(
"notifications",
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
nullable=False,
server_default=sa.func.now(),
),
conn = op.get_bind()
result = conn.execute(
sa.text(
"SELECT column_name FROM information_schema.columns "
"WHERE table_name = 'notifications' AND column_name = 'updated_at'"
)
)
if result.fetchone() is None:
op.add_column(
"notifications",
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
nullable=False,
server_default=sa.func.now(),
),
)
def downgrade() -> None: