From 6972db1faa192c1ebbb1db4af14fdb2b97ab7674 Mon Sep 17 00:00:00 2001 From: hided62 Date: Thu, 13 Aug 2026 17:55:10 +0000 Subject: [PATCH] fix(infra): support legacy gateway uniqueness constraint --- .../migration.sql | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/infra/prisma/gateway-migrations/20260813000000_split_gateway_profile_identity/migration.sql b/packages/infra/prisma/gateway-migrations/20260813000000_split_gateway_profile_identity/migration.sql index d5cfff34..33da5caf 100644 --- a/packages/infra/prisma/gateway-migrations/20260813000000_split_gateway_profile_identity/migration.sql +++ b/packages/infra/prisma/gateway-migrations/20260813000000_split_gateway_profile_identity/migration.sql @@ -27,7 +27,14 @@ SET ALTER TABLE "gateway_profile" ALTER COLUMN "instance_key" SET NOT NULL; -DROP INDEX "gateway_profile_profile_scenario_key"; +-- Older combined-schema installs created this uniqueness rule as a table +-- constraint, while the standalone Gateway baseline created a unique index. +-- Dropping the constraint first also removes its backing index; the second +-- statement handles the standalone-index shape and is then a no-op otherwise. +ALTER TABLE "gateway_profile" +DROP CONSTRAINT IF EXISTS "gateway_profile_profile_scenario_key"; + +DROP INDEX IF EXISTS "gateway_profile_profile_scenario_key"; ALTER TABLE "gateway_profile" ADD CONSTRAINT "gateway_profile_profile_instance_key_key" UNIQUE ("profile", "instance_key"),