fix: make migration 0020 idempotent (check column exists)
This commit is contained in:
@@ -15,6 +15,14 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user