gate2: fix all migrations for fresh DB installation

This commit is contained in:
Agent Zero
2026-07-31 19:16:11 +02:00
parent d37388423d
commit 010ef448e7
40 changed files with 230 additions and 207 deletions
@@ -54,7 +54,7 @@ def upgrade() -> None:
sa.Column("is_enabled_by_default", sa.Boolean(), nullable=False, server_default=sa.text("true")),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
)
op.create_index("ix_notification_types_key", "notification_types", ["type_key"])
op.execute('CREATE INDEX IF NOT EXISTS ix_notification_types_key ON notification_types (type_key)')
# notification_preferences table
op.create_table(
@@ -67,8 +67,8 @@ def upgrade() -> None:
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
sa.UniqueConstraint("user_id", "type_key", name="uq_notif_pref_user_type"),
)
op.create_index("ix_notif_prefs_user", "notification_preferences", ["user_id"])
op.create_index("ix_notif_prefs_tenant", "notification_preferences", ["tenant_id"])
op.execute('CREATE INDEX IF NOT EXISTS ix_notif_prefs_user ON notification_preferences (user_id)')
op.execute('CREATE INDEX IF NOT EXISTS ix_notif_prefs_tenant ON notification_preferences (tenant_id)')
# Seed mail plugin notification types
for nt in MAIL_NOTIFICATION_TYPES: