diff --git a/packages/db/migrations/0184_fast_photon.sql b/packages/db/migrations/0184_stiff_captain_marvel.sql similarity index 54% rename from packages/db/migrations/0184_fast_photon.sql rename to packages/db/migrations/0184_stiff_captain_marvel.sql index 35c96397c4..80a22d7ca4 100644 --- a/packages/db/migrations/0184_fast_photon.sql +++ b/packages/db/migrations/0184_stiff_captain_marvel.sql @@ -1,4 +1,3 @@ ALTER TYPE "public"."credential_type" ADD VALUE 'service_account';--> statement-breakpoint ALTER TABLE "credential" ADD COLUMN "encrypted_service_account_key" text;--> statement-breakpoint -CREATE UNIQUE INDEX "credential_workspace_service_account_unique" ON "credential" USING btree ("workspace_id","type","provider_id","display_name") WHERE type = 'service_account';--> statement-breakpoint -ALTER TABLE "credential" ADD CONSTRAINT "credential_service_account_source_check" CHECK ((type <> 'service_account') OR (encrypted_service_account_key IS NOT NULL AND provider_id IS NOT NULL)); \ No newline at end of file +CREATE UNIQUE INDEX "credential_workspace_service_account_unique" ON "credential" USING btree ("workspace_id","type","provider_id","display_name") WHERE type = 'service_account'; \ No newline at end of file diff --git a/packages/db/migrations/meta/0184_snapshot.json b/packages/db/migrations/meta/0184_snapshot.json index c3e8575c78..5487bf90d4 100644 --- a/packages/db/migrations/meta/0184_snapshot.json +++ b/packages/db/migrations/meta/0184_snapshot.json @@ -1,5 +1,5 @@ { - "id": "1c75b73c-f8d0-4b69-b42a-995991f56e35", + "id": "7f097b1f-1207-472e-b1bc-e237bab9528c", "prevId": "1114a957-9e5b-49fe-b82d-ef3612189345", "version": "7", "dialect": "postgresql", @@ -3019,10 +3019,6 @@ "credential_personal_env_source_check": { "name": "credential_personal_env_source_check", "value": "(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)" - }, - "credential_service_account_source_check": { - "name": "credential_service_account_source_check", - "value": "(type <> 'service_account') OR (encrypted_service_account_key IS NOT NULL AND provider_id IS NOT NULL)" } }, "isRLSEnabled": false diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json index ff99683522..ed0d5da63b 100644 --- a/packages/db/migrations/meta/_journal.json +++ b/packages/db/migrations/meta/_journal.json @@ -1286,8 +1286,8 @@ { "idx": 184, "version": "7", - "when": 1774986262590, - "tag": "0184_fast_photon", + "when": 1775118314401, + "tag": "0184_stiff_captain_marvel", "breakpoints": true } ] diff --git a/packages/db/schema.ts b/packages/db/schema.ts index 15ad9f601e..6cb50f1c7c 100644 --- a/packages/db/schema.ts +++ b/packages/db/schema.ts @@ -2365,10 +2365,6 @@ export const credential = pgTable( 'credential_personal_env_source_check', sql`(type <> 'env_personal') OR (env_key IS NOT NULL AND env_owner_user_id IS NOT NULL)` ), - serviceAccountSourceConstraint: check( - 'credential_service_account_source_check', - sql`(type <> 'service_account') OR (encrypted_service_account_key IS NOT NULL AND provider_id IS NOT NULL)` - ), }) )