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
@@ -19,8 +19,9 @@ depends_on = None
def upgrade() -> None:
op.add_column("notifications", sa.Column("entity_type", sa.String(50), nullable=True, index=True))
op.add_column("notifications", sa.Column("entity_id", UUID(as_uuid=True), nullable=True))
op.execute("ALTER TABLE notifications ADD COLUMN IF NOT EXISTS entity_type VARCHAR(50)")
op.execute("CREATE INDEX IF NOT EXISTS ix_notifications_entity_type ON notifications (entity_type)")
op.execute("ALTER TABLE notifications ADD COLUMN IF NOT EXISTS entity_id UUID")
def downgrade() -> None: