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
+1 -4
View File
@@ -31,10 +31,7 @@ def upgrade():
op.create_index("ix_contact_folders_user", "contact_folders", ["user_id"])
# 2. Add folder_id column to contacts
op.add_column(
"contacts",
sa.Column("folder_id", UUID(as_uuid=True), sa.ForeignKey("contact_folders.id", ondelete="SET NULL"), nullable=True),
)
op.execute("ALTER TABLE contacts ADD COLUMN IF NOT EXISTS folder_id UUID REFERENCES contact_folders(id) ON DELETE SET NULL")
op.create_index("ix_contacts_folder_id", "contacts", ["folder_id"])