gate2: fix duplicate column/index in migrations for fresh DB installation

This commit is contained in:
Agent Zero
2026-07-31 18:20:09 +02:00
parent 224a5ea9af
commit dd7ad461d8
17 changed files with 53 additions and 78 deletions
@@ -15,14 +15,8 @@ depends_on = None
def upgrade() -> None:
# Add missing columns from TimestampMixin and SoftDeleteMixin
op.add_column(
"notification_preferences",
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
)
op.add_column(
"notification_preferences",
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
)
op.execute("ALTER TABLE notification_preferences ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()")
op.execute("ALTER TABLE notification_preferences ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ")
def downgrade() -> None: