mirror of
https://github.com/simstudioai/sim.git
synced 2026-08-30 17:05:18 +08:00
fix(credential): fix service_account migration to avoid unsafe enum usage in same transaction (#3897)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
ALTER TYPE "public"."credential_type" ADD VALUE 'service_account';--> statement-breakpoint
|
||||
ALTER TABLE "credential" ADD COLUMN "encrypted_service_account_key" text;
|
||||
@@ -1,3 +0,0 @@
|
||||
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';
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "7f097b1f-1207-472e-b1bc-e237bab9528c",
|
||||
"id": "1a38a6e2-09e2-4215-baa2-662f78824768",
|
||||
"prevId": "1114a957-9e5b-49fe-b82d-ef3612189345",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
@@ -2930,40 +2930,6 @@
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
},
|
||||
"credential_workspace_service_account_unique": {
|
||||
"name": "credential_workspace_service_account_unique",
|
||||
"columns": [
|
||||
{
|
||||
"expression": "workspace_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "type",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "provider_id",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
},
|
||||
{
|
||||
"expression": "display_name",
|
||||
"isExpression": false,
|
||||
"asc": true,
|
||||
"nulls": "last"
|
||||
}
|
||||
],
|
||||
"isUnique": true,
|
||||
"where": "type = 'service_account'",
|
||||
"concurrently": false,
|
||||
"method": "btree",
|
||||
"with": {}
|
||||
}
|
||||
},
|
||||
"foreignKeys": {
|
||||
|
||||
@@ -1286,8 +1286,8 @@
|
||||
{
|
||||
"idx": 184,
|
||||
"version": "7",
|
||||
"when": 1775118314401,
|
||||
"tag": "0184_stiff_captain_marvel",
|
||||
"when": 1775149654511,
|
||||
"tag": "0184_hard_thaddeus_ross",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2350,9 +2350,6 @@ export const credential = pgTable(
|
||||
workspacePersonalEnvUnique: uniqueIndex('credential_workspace_personal_env_unique')
|
||||
.on(table.workspaceId, table.type, table.envKey, table.envOwnerUserId)
|
||||
.where(sql`type = 'env_personal'`),
|
||||
workspaceServiceAccountUnique: uniqueIndex('credential_workspace_service_account_unique')
|
||||
.on(table.workspaceId, table.type, table.providerId, table.displayName)
|
||||
.where(sql`type = 'service_account'`),
|
||||
oauthSourceConstraint: check(
|
||||
'credential_oauth_source_check',
|
||||
sql`(type <> 'oauth') OR (account_id IS NOT NULL AND provider_id IS NOT NULL)`
|
||||
|
||||
Reference in New Issue
Block a user