fix(credential) fix credential migration (#3896)

* fix(credential) fix credential migration

* Fix lint

---------

Co-authored-by: Theodore Li <theo@sim.ai>
This commit is contained in:
Theodore Li
2026-04-02 01:29:01 -07:00
committed by GitHub
parent bbc704fe05
commit fc6fe193fa
4 changed files with 4 additions and 13 deletions

View File

@@ -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));
CREATE UNIQUE INDEX "credential_workspace_service_account_unique" ON "credential" USING btree ("workspace_id","type","provider_id","display_name") WHERE type = 'service_account';

View File

@@ -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

View File

@@ -1286,8 +1286,8 @@
{
"idx": 184,
"version": "7",
"when": 1774986262590,
"tag": "0184_fast_photon",
"when": 1775118314401,
"tag": "0184_stiff_captain_marvel",
"breakpoints": true
}
]

View File

@@ -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)`
),
})
)