Skip to content

Commit 2b3d54a

Browse files
authored
Make removing the httpEndpointEnvironmentId column migration correctly idempotent (#2154)
1 parent bb1f0a7 commit 2b3d54a

File tree

1 file changed

+11
-1
lines changed
  • internal-packages/database/prisma/migrations/20250526094044_remove_v2_trigger_http_endpoint_environment

1 file changed

+11
-1
lines changed

internal-packages/database/prisma/migrations/20250526094044_remove_v2_trigger_http_endpoint_environment/migration.sql

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66
77
*/
88
-- AlterTable
9-
ALTER TABLE "EventRecord" DROP COLUMN IF EXISTS "httpEndpointEnvironmentId" CASCADE;
9+
DO $$
10+
BEGIN
11+
IF EXISTS (
12+
SELECT 1
13+
FROM information_schema.tables
14+
WHERE table_name = 'EventRecord'
15+
) THEN
16+
ALTER TABLE "EventRecord" DROP COLUMN IF EXISTS "httpEndpointEnvironmentId" CASCADE;
17+
END IF;
18+
END $$;
19+
1020

1121
-- DropTable
1222
DROP TABLE IF EXISTS "TriggerHttpEndpointEnvironment" CASCADE;

0 commit comments

Comments
 (0)