diff --git a/apps/webservice/src/app/api/v1/config/route.ts b/apps/webservice/src/app/api/v1/config/route.ts index 4c29b84bf..401d649ca 100644 --- a/apps/webservice/src/app/api/v1/config/route.ts +++ b/apps/webservice/src/app/api/v1/config/route.ts @@ -174,7 +174,9 @@ const upsertReleases = async (db: Tx, config: CacV1, userId: string) => { .groupBy((d) => d.deployment.id) .map((deploymentGroup) => ({ ...deploymentGroup[0]!, - releases: deploymentGroup.map((d) => d.release).filter(isPresent), + releases: deploymentGroup + .map((d) => d.deployment_version) + .filter(isPresent), })) .value(), ); diff --git a/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts b/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts index 6c1ea9eb8..8c352923f 100644 --- a/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts +++ b/apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts @@ -59,11 +59,11 @@ export const GET = async ( target: jobRows[0]!.resource, deployment: jobRows[0]!.deployment, release: - jobRows[0]!.release != null + jobRows[0]!.deployment_version != null ? { - ...jobRows[0]!.release, + ...jobRows[0]!.deployment_version, metadata: jobRows - .map((r) => r.release_metadata) + .map((r) => r.deployment_version_metadata) .filter(isPresent), } : null, diff --git a/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts b/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts index 4ec54f661..58d6d98ce 100644 --- a/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts +++ b/apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts @@ -102,7 +102,9 @@ export const GET = request() ); const release = - row.release != null ? { ...row.release, metadata: {} } : null; + row.deployment_version != null + ? { ...row.deployment_version, metadata: {} } + : null; const je = { job: row.job, diff --git a/integrations/kubernetes-job-agent/src/index.ts b/integrations/kubernetes-job-agent/src/index.ts index b3c40c3a0..5239362ec 100644 --- a/integrations/kubernetes-job-agent/src/index.ts +++ b/integrations/kubernetes-job-agent/src/index.ts @@ -94,7 +94,7 @@ const spinUpNewJobs = async () => { ); if (!parseResult.success) { await job.update({ - status: "failed", + status: "failure", message: "Invalid job agent configuration: " + parseResult.error.message, }); diff --git a/integrations/kubernetes-job-agent/src/k8s.ts b/integrations/kubernetes-job-agent/src/k8s.ts index 593eecd54..8d3abda15 100644 --- a/integrations/kubernetes-job-agent/src/k8s.ts +++ b/integrations/kubernetes-job-agent/src/k8s.ts @@ -68,7 +68,7 @@ export const getJobStatus = async (namespace: string, name: string) => { logger.info( `Job ${name} in namespace ${namespace} completed successfully`, ); - return { status: "completed" as const, message }; + return { status: "successful" as const, message }; } logger.warn(`Job ${name} in namespace ${namespace} has an unknown status`); diff --git a/packages/api/src/router/deployment.ts b/packages/api/src/router/deployment.ts index 10ae9f0ba..021ae3166 100644 --- a/packages/api/src/router/deployment.ts +++ b/packages/api/src/router/deployment.ts @@ -402,7 +402,7 @@ export const deploymentRouter = createTRPCRouter({ .then((r) => r.map((row) => ({ ...row.latest_jobs, - release: row.release, + release: row.deployment_version, resource: row.resource, releaseJobTrigger: row.release_job_trigger, })), @@ -533,7 +533,7 @@ export const deploymentRouter = createTRPCRouter({ system: { ...r[0].system, workspace: r[0].workspace }, agent: r[0].job_agent, releaseChannels: r - .map((r) => r.release_channel) + .map((r) => r.deployment_version_channel) .filter(isPresent), }, ), @@ -565,7 +565,7 @@ export const deploymentRouter = createTRPCRouter({ ...t[0]!.deployment, system: t[0]!.system, releaseChannels: _.chain(t) - .map((a) => a.release_channel) + .map((a) => a.deployment_version_channel) .filter(isPresent) .uniqBy((a) => a.id) .value(), @@ -645,7 +645,7 @@ export const deploymentRouter = createTRPCRouter({ ? { ...row.release_job_trigger, job: row.job!, - release: row.release!, + release: row.deployment_version!, resourceId: row.resource.id, } : null, diff --git a/packages/api/src/router/environment-policy.ts b/packages/api/src/router/environment-policy.ts index 70497ed05..f5fbfecb7 100644 --- a/packages/api/src/router/environment-policy.ts +++ b/packages/api/src/router/environment-policy.ts @@ -157,7 +157,7 @@ export const policyRouter = createTRPCRouter({ .then((rows) => { const policy = rows.at(0)!; const releaseChannels = _.chain(rows) - .map((r) => r.release_channel) + .map((r) => r.deployment_version_channel) .filter(isPresent) .uniqBy((r) => r.id) .value(); @@ -196,7 +196,7 @@ export const policyRouter = createTRPCRouter({ .then((rows) => { const policy = rows.at(0)!; const releaseChannels = _.chain(rows) - .map((r) => r.release_channel) + .map((r) => r.deployment_version_channel) .filter(isPresent) .uniqBy((r) => r.id) .value(); diff --git a/packages/api/src/router/job.ts b/packages/api/src/router/job.ts index 369413d7d..a04ba1997 100644 --- a/packages/api/src/router/job.ts +++ b/packages/api/src/router/job.ts @@ -192,7 +192,10 @@ const releaseJobTriggerRouter = createTRPCRouter({ }, jobAgent: v[0]!.job_agent, resource: v[0]!.resource, - release: { ...v[0]!.release, deployment: v[0]!.deployment }, + release: { + ...v[0]!.deployment_version, + deployment: v[0]!.deployment, + }, environment: v[0]!.environment, })) .value(), @@ -420,6 +423,12 @@ const releaseJobTriggerRouter = createTRPCRouter({ .orderBy(desc(schema.releaseJobTrigger.createdAt)) .limit(input.limit) .offset(input.offset) + .then((r) => + r.map((row) => ({ + ...row, + release: row.deployment_version, + })), + ) .then(processReleaseJobTriggerWithAdditionalDataRows), ), @@ -474,6 +483,12 @@ const releaseJobTriggerRouter = createTRPCRouter({ ), ) .where(and(eq(schema.job.id, input), isNull(schema.resource.deletedAt))) + .then((r) => + r.map((row) => ({ + ...row, + release: row.deployment_version, + })), + ) .then(processReleaseJobTriggerWithAdditionalDataRows) .then(takeFirst); @@ -768,7 +783,7 @@ export const jobRouter = createTRPCRouter({ agent: t.job_agent, resource: t.resource, deployment: t.deployment, - release: { ...t.release }, + release: { ...t.deployment_version }, environment: t.environment, })), ), diff --git a/packages/api/src/router/release.ts b/packages/api/src/router/release.ts index 231380cc9..07f4adc28 100644 --- a/packages/api/src/router/release.ts +++ b/packages/api/src/router/release.ts @@ -105,11 +105,11 @@ export const releaseRouter = createTRPCRouter({ .offset(input.offset) .then((data) => _.chain(data) - .groupBy((r) => r.release.id) + .groupBy((r) => r.deployment_version.id) .map((r) => ({ - ...r[0]!.release, + ...r[0]!.deployment_version, releaseDependencies: r - .map((rd) => rd.release_dependency) + .map((rd) => rd.deployment_version_dependency) .filter(isPresent), })) .value(), @@ -150,12 +150,12 @@ export const releaseRouter = createTRPCRouter({ .where(eq(release.id, input)) .then((rows) => _.chain(rows) - .groupBy((r) => r.release.id) + .groupBy((r) => r.deployment_version.id) .map((r) => ({ - ...r[0]!.release, + ...r[0]!.deployment_version, dependencies: r .filter(isPresent) - .map((r) => r.release_dependency!), + .map((r) => r.deployment_version_dependency!), })) .value() .at(0), @@ -289,9 +289,9 @@ export const releaseRouter = createTRPCRouter({ .where(inArray(release.id, input)) .then((rows) => _.chain(rows) - .groupBy((e) => [e.environment.id, e.release.id]) + .groupBy((e) => [e.environment.id, e.deployment_version.id]) .map((v) => ({ - release: v[0]!.release, + release: v[0]!.deployment_version, environment: v[0]!.environment, environmentPolicy: v[0]!.environment_policy ? { @@ -489,7 +489,7 @@ export const releaseRouter = createTRPCRouter({ .orderBy(desc(release.createdAt)) .limit(1) .then(takeFirstOrNull) - .then((r) => r?.release ?? null), + .then((r) => r?.deployment_version ?? null), ), byDeploymentAndEnvironment: protectedProcedure @@ -557,10 +557,10 @@ export const releaseRouter = createTRPCRouter({ and( eq(release.status, ReleaseStatus.Ready), eq(release.deploymentId, deploymentId), - env.release_channel != null + env.deployment_version_channel != null ? releaseMatchesCondition( ctx.db, - env.release_channel.releaseFilter, + env.deployment_version_channel.releaseFilter, ) : undefined, ), @@ -579,7 +579,7 @@ export const releaseRouter = createTRPCRouter({ if (env.environment.resourceFilter == null) return { - ...rel.release, + ...rel.deployment_version, approval: rel.environment_policy_approval, resourceCount: 0, }; @@ -606,7 +606,7 @@ export const releaseRouter = createTRPCRouter({ .then(takeFirst); return { - ...rel.release, + ...rel.deployment_version, approval: rel.environment_policy_approval, resourceCount: resourceCount.count, }; diff --git a/packages/api/src/router/resource-stats.ts b/packages/api/src/router/resource-stats.ts index 40bd15b75..063d98731 100644 --- a/packages/api/src/router/resource-stats.ts +++ b/packages/api/src/router/resource-stats.ts @@ -102,7 +102,7 @@ const healthRouter = createTRPCRouter({ rows.map((row) => ({ ...row.job, deployment: row.deployment, - release: row.release, + release: row.deployment_version, })), ); }), diff --git a/packages/api/src/router/resources.ts b/packages/api/src/router/resources.ts index 0b1cec869..e51fd5ef7 100644 --- a/packages/api/src/router/resources.ts +++ b/packages/api/src/router/resources.ts @@ -157,7 +157,7 @@ const latestActiveReleaseByResourceAndEnvironmentId = ( releaseJobTrigger: { ...row.release_job_trigger, job: row.job, - release: row.release, + release: row.deployment_version, resourceId: row.resource.id, }, })), diff --git a/packages/auth/src/utils/rbac.ts b/packages/auth/src/utils/rbac.ts index 04e63e50a..7edcd8fc4 100644 --- a/packages/auth/src/utils/rbac.ts +++ b/packages/auth/src/utils/rbac.ts @@ -99,8 +99,8 @@ const getReleaseScopes = async (id: string) => { .then(takeFirst); return [ - { type: "release" as const, id: result.release.id }, - { type: "deployment" as const, id: result.deployment.id }, + { type: "release" as const, id: result.deployment_version.id }, + { type: "deployment" as const, id: result.deployment_version.id }, { type: "system" as const, id: result.system.id }, { type: "workspace" as const, id: result.workspace.id }, ]; @@ -117,7 +117,10 @@ const getReleaseChannelScopes = async (id: string) => { .then(takeFirst); return [ - { type: "releaseChannel" as const, id: result.release_channel.id }, + { + type: "releaseChannel" as const, + id: result.deployment_version_channel.id, + }, { type: "deployment" as const, id: result.deployment.id }, { type: "system" as const, id: result.system.id }, { type: "workspace" as const, id: result.workspace.id }, @@ -363,7 +366,7 @@ const getJobScopes = async (id: string) => { { type: "job" as const, id: result.job.id }, { type: "resource" as const, id: result.resource.id }, { type: "environment" as const, id: result.environment.id }, - { type: "release" as const, id: result.release.id }, + { type: "release" as const, id: result.deployment_version.id }, { type: "deployment" as const, id: result.deployment.id }, { type: "system" as const, id: result.system.id }, { type: "workspace" as const, id: result.workspace.id }, diff --git a/packages/db/drizzle/0075_safe_red_wolf.sql b/packages/db/drizzle/0075_safe_red_wolf.sql new file mode 100644 index 000000000..1fd7acf77 --- /dev/null +++ b/packages/db/drizzle/0075_safe_red_wolf.sql @@ -0,0 +1,105 @@ +ALTER TABLE "release" RENAME TO "deployment_version";--> statement-breakpoint +ALTER TABLE "release_channel" RENAME TO "deployment_version_channel";--> statement-breakpoint +ALTER TABLE "release_dependency" RENAME TO "deployment_version_dependency";--> statement-breakpoint +ALTER TABLE "release_metadata" RENAME TO "deployment_version_metadata";--> statement-breakpoint +ALTER TABLE "environment_policy_release_channel" RENAME TO "environment_policy_deployment_version_channel";--> statement-breakpoint +ALTER TABLE "deployment_version" RENAME COLUMN "version" TO "tag";--> statement-breakpoint +ALTER TABLE "deployment_version_channel" RENAME COLUMN "release_filter" TO "deployment_version_selector";--> statement-breakpoint +ALTER TABLE "deployment_version_dependency" RENAME COLUMN "release_id" TO "deployment_version_id";--> statement-breakpoint +ALTER TABLE "deployment_version_dependency" RENAME COLUMN "release_filter" TO "deployment_version_selector";--> statement-breakpoint +ALTER TABLE "release_job_trigger" RENAME COLUMN "release_id" TO "deployment_version_id";--> statement-breakpoint +ALTER TABLE "deployment_version_metadata" RENAME COLUMN "release_id" TO "deployment_version_id";--> statement-breakpoint +ALTER TABLE "environment_policy_approval" DROP CONSTRAINT "environment_policy_approval_release_id_release_id_fk"; +--> statement-breakpoint +ALTER TABLE "deployment_version" DROP CONSTRAINT "release_deployment_id_deployment_id_fk"; +--> statement-breakpoint +ALTER TABLE "deployment_version_channel" DROP CONSTRAINT "release_channel_deployment_id_deployment_id_fk"; +--> statement-breakpoint +ALTER TABLE "deployment_version_dependency" DROP CONSTRAINT "release_dependency_release_id_release_id_fk"; +--> statement-breakpoint +ALTER TABLE "deployment_version_dependency" DROP CONSTRAINT "release_dependency_deployment_id_deployment_id_fk"; +--> statement-breakpoint +ALTER TABLE "release_job_trigger" DROP CONSTRAINT "release_job_trigger_release_id_release_id_fk"; +--> statement-breakpoint +ALTER TABLE "deployment_version_metadata" DROP CONSTRAINT "release_metadata_release_id_release_id_fk"; +--> statement-breakpoint +ALTER TABLE "environment_policy_deployment_version_channel" DROP CONSTRAINT "environment_policy_release_channel_policy_id_environment_policy_id_fk"; +--> statement-breakpoint +ALTER TABLE "environment_policy_deployment_version_channel" DROP CONSTRAINT "environment_policy_release_channel_channel_id_release_channel_id_fk"; +--> statement-breakpoint +ALTER TABLE "environment_policy_deployment_version_channel" DROP CONSTRAINT "environment_policy_release_channel_deployment_id_deployment_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "release_deployment_id_version_index";--> statement-breakpoint +DROP INDEX IF EXISTS "release_created_at_idx";--> statement-breakpoint +DROP INDEX IF EXISTS "release_channel_deployment_id_name_index";--> statement-breakpoint +DROP INDEX IF EXISTS "release_dependency_release_id_deployment_id_index";--> statement-breakpoint +DROP INDEX IF EXISTS "release_metadata_key_release_id_index";--> statement-breakpoint +DROP INDEX IF EXISTS "environment_policy_release_channel_policy_id_channel_id_index";--> statement-breakpoint +DROP INDEX IF EXISTS "environment_policy_release_channel_policy_id_deployment_id_index";--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "environment_policy_approval" ADD CONSTRAINT "environment_policy_approval_release_id_deployment_version_id_fk" FOREIGN KEY ("release_id") REFERENCES "public"."deployment_version"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment_version" ADD CONSTRAINT "deployment_version_deployment_id_deployment_id_fk" FOREIGN KEY ("deployment_id") REFERENCES "public"."deployment"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment_version_channel" ADD CONSTRAINT "deployment_version_channel_deployment_id_deployment_id_fk" FOREIGN KEY ("deployment_id") REFERENCES "public"."deployment"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment_version_dependency" ADD CONSTRAINT "deployment_version_dependency_deployment_version_id_deployment_version_id_fk" FOREIGN KEY ("deployment_version_id") REFERENCES "public"."deployment_version"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment_version_dependency" ADD CONSTRAINT "deployment_version_dependency_deployment_id_deployment_id_fk" FOREIGN KEY ("deployment_id") REFERENCES "public"."deployment"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "release_job_trigger" ADD CONSTRAINT "release_job_trigger_deployment_version_id_deployment_version_id_fk" FOREIGN KEY ("deployment_version_id") REFERENCES "public"."deployment_version"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment_version_metadata" ADD CONSTRAINT "deployment_version_metadata_deployment_version_id_deployment_version_id_fk" FOREIGN KEY ("deployment_version_id") REFERENCES "public"."deployment_version"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "environment_policy_deployment_version_channel" ADD CONSTRAINT "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk" FOREIGN KEY ("policy_id") REFERENCES "public"."environment_policy"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "environment_policy_deployment_version_channel" ADD CONSTRAINT "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk" FOREIGN KEY ("channel_id") REFERENCES "public"."deployment_version_channel"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "environment_policy_deployment_version_channel" ADD CONSTRAINT "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk" FOREIGN KEY ("deployment_id") REFERENCES "public"."deployment"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "deployment_version_deployment_id_tag_index" ON "deployment_version" USING btree ("deployment_id","tag");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "deployment_version_created_at_idx" ON "deployment_version" USING btree ("created_at");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "deployment_version_channel_deployment_id_name_index" ON "deployment_version_channel" USING btree ("deployment_id","name");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "deployment_version_dependency_deployment_version_id_deployment_id_index" ON "deployment_version_dependency" USING btree ("deployment_version_id","deployment_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "deployment_version_metadata_key_deployment_version_id_index" ON "deployment_version_metadata" USING btree ("key","deployment_version_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "environment_policy_deployment_version_channel_policy_id_channel_id_index" ON "environment_policy_deployment_version_channel" USING btree ("policy_id","channel_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "environment_policy_deployment_version_channel_policy_id_deployment_id_index" ON "environment_policy_deployment_version_channel" USING btree ("policy_id","deployment_id"); \ No newline at end of file diff --git a/packages/db/drizzle/meta/0075_snapshot.json b/packages/db/drizzle/meta/0075_snapshot.json new file mode 100644 index 000000000..331afd423 --- /dev/null +++ b/packages/db/drizzle/meta/0075_snapshot.json @@ -0,0 +1,4557 @@ +{ + "id": "0936cf7b-63dd-4789-b0ed-9e466af42af6", + "prevId": "c0700fe7-ecbf-4391-862a-25748caa6c21", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "active_workspace_id": { + "name": "active_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "null" + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "null" + }, + "system_role": { + "name": "system_role", + "type": "system_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_api_key_key_prefix_key_hash_index": { + "name": "user_api_key_key_prefix_key_hash_index", + "columns": [ + { + "expression": "key_prefix", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "default_value_id": { + "name": "default_value_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_key_index": { + "name": "deployment_variable_deployment_id_key_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_variable_deployment_id_deployment_id_fk": { + "name": "deployment_variable_deployment_id_deployment_id_fk", + "tableFrom": "deployment_variable", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_variable_default_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_default_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable", + "tableTo": "deployment_variable_value", + "columnsFrom": ["default_value_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_set": { + "name": "deployment_variable_set", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "variable_set_id": { + "name": "variable_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_set_deployment_id_variable_set_id_index": { + "name": "deployment_variable_set_deployment_id_variable_set_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "variable_set_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_variable_set_deployment_id_deployment_id_fk": { + "name": "deployment_variable_set_deployment_id_deployment_id_fk", + "tableFrom": "deployment_variable_set", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_variable_set_variable_set_id_variable_set_id_fk": { + "name": "deployment_variable_set_variable_set_id_variable_set_id_fk", + "tableFrom": "deployment_variable_set", + "tableTo": "variable_set", + "columnsFrom": ["variable_set_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_id": { + "name": "variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "resource_filter": { + "name": "resource_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "deployment_variable_value_variable_id_value_index": { + "name": "deployment_variable_value_variable_id_value_index", + "columns": [ + { + "expression": "variable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "value", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_variable_value_variable_id_deployment_variable_id_fk": { + "name": "deployment_variable_value_variable_id_deployment_variable_id_fk", + "tableFrom": "deployment_variable_value", + "tableTo": "deployment_variable", + "columnsFrom": ["variable_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "restrict" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "retry_count": { + "name": "retry_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "timeout": { + "name": "timeout", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "resource_filter": { + "name": "resource_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "deployment_system_id_slug_index": { + "name": "deployment_system_id_slug_index", + "columns": [ + { + "expression": "system_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_system_id_system_id_fk": { + "name": "deployment_system_id_system_id_fk", + "tableFrom": "deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_job_agent_id_job_agent_id_fk": { + "name": "deployment_job_agent_id_job_agent_id_fk", + "tableFrom": "deployment", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_meta_dependency": { + "name": "deployment_meta_dependency", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "depends_on_id": { + "name": "depends_on_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_meta_dependency_depends_on_id_deployment_id_index": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", + "columns": [ + { + "expression": "depends_on_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_meta_dependency_deployment_id_deployment_id_fk": { + "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_meta_dependency_depends_on_id_deployment_id_fk": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["depends_on_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_deployment": { + "name": "environment_policy_deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_policy_deployment_policy_id_environment_id_index": { + "name": "environment_policy_deployment_policy_id_environment_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_policy_deployment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_environment_id_environment_id_fk": { + "name": "environment_policy_deployment_environment_id_environment_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "directory": { + "name": "directory", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_filter": { + "name": "resource_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "environment_system_id_name_index": { + "name": "environment_system_id_name_index", + "columns": [ + { + "expression": "system_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_system_id_system_id_fk": { + "name": "environment_system_id_system_id_fk", + "tableFrom": "environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_id_environment_policy_id_fk", + "tableFrom": "environment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_metadata": { + "name": "environment_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_metadata_key_environment_id_index": { + "name": "environment_metadata_key_environment_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_metadata_environment_id_environment_id_fk": { + "name": "environment_metadata_environment_id_environment_id_fk", + "tableFrom": "environment_metadata", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy": { + "name": "environment_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "approval_required": { + "name": "approval_required", + "type": "environment_policy_approval_requirement", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'automatic'" + }, + "success_status": { + "name": "success_status", + "type": "environment_policy_deployment_success_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "minimum_success": { + "name": "minimum_success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "concurrency_limit": { + "name": "concurrency_limit", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "rollout_duration": { + "name": "rollout_duration", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "minimum_release_interval": { + "name": "minimum_release_interval", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "release_sequencing": { + "name": "release_sequencing", + "type": "release_sequencing_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'cancel'" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_system_id_system_id_fk": { + "name": "environment_policy_system_id_system_id_fk", + "tableFrom": "environment_policy", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_environment_id_environment_id_fk": { + "name": "environment_policy_environment_id_environment_id_fk", + "tableFrom": "environment_policy", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_approval": { + "name": "environment_policy_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "approval_status_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "approved_at": { + "name": "approved_at", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "environment_policy_approval_policy_id_release_id_index": { + "name": "environment_policy_approval_policy_id_release_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_policy_approval_policy_id_environment_policy_id_fk": { + "name": "environment_policy_approval_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_approval_release_id_deployment_version_id_fk": { + "name": "environment_policy_approval_release_id_deployment_version_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "deployment_version", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_approval_user_id_user_id_fk": { + "name": "environment_policy_approval_user_id_user_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_release_window": { + "name": "environment_policy_release_window", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "recurrence": { + "name": "recurrence", + "type": "recurrence_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_release_window_policy_id_environment_policy_id_fk": { + "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_release_window", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.event": { + "name": "event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.hook": { + "name": "hook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runhook": { + "name": "runhook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hook_id": { + "name": "hook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "runhook_hook_id_runbook_id_index": { + "name": "runhook_hook_id_runbook_id_index", + "columns": [ + { + "expression": "hook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "runbook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "runhook_hook_id_hook_id_fk": { + "name": "runhook_hook_id_hook_id_fk", + "tableFrom": "runhook", + "tableTo": "hook", + "columnsFrom": ["hook_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "runhook_runbook_id_runbook_id_fk": { + "name": "runhook_runbook_id_runbook_id_fk", + "tableFrom": "runhook", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_entity": { + "name": "github_entity", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "installation_id": { + "name": "installation_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "github_entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'organization'" + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "added_by_user_id": { + "name": "added_by_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "unique_installation_workspace": { + "name": "unique_installation_workspace", + "columns": [ + { + "expression": "installation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "github_entity_added_by_user_id_user_id_fk": { + "name": "github_entity_added_by_user_id_user_id_fk", + "tableFrom": "github_entity", + "tableTo": "user", + "columnsFrom": ["added_by_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_entity_workspace_id_workspace_id_fk": { + "name": "github_entity_workspace_id_workspace_id_fk", + "tableFrom": "github_entity", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_user": { + "name": "github_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "github_user_id": { + "name": "github_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "github_user_user_id_user_id_fk": { + "name": "github_user_user_id_user_id_fk", + "tableFrom": "github_user", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_resource_relationship": { + "name": "job_resource_relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_identifier": { + "name": "resource_identifier", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_resource_relationship_job_id_resource_identifier_index": { + "name": "job_resource_relationship_job_id_resource_identifier_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_resource_relationship_job_id_job_id_fk": { + "name": "job_resource_relationship_job_id_job_id_fk", + "tableFrom": "job_resource_relationship", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource": { + "name": "resource", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "locked_at": { + "name": "locked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resource_identifier_workspace_id_index": { + "name": "resource_identifier_workspace_id_index", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource", + "tableTo": "resource_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_workspace_id_workspace_id_fk": { + "name": "resource_workspace_id_workspace_id_fk", + "tableFrom": "resource", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_metadata": { + "name": "resource_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "resource_metadata_key_resource_id_index": { + "name": "resource_metadata_key_resource_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_metadata_resource_id_resource_id_fk": { + "name": "resource_metadata_resource_id_resource_id_fk", + "tableFrom": "resource_metadata", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_relationship": { + "name": "resource_relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "from_identifier": { + "name": "from_identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "to_identifier": { + "name": "to_identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "resource_relationship_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "resource_relationship_to_identifier_from_identifier_index": { + "name": "resource_relationship_to_identifier_from_identifier_index", + "columns": [ + { + "expression": "to_identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "from_identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_relationship_workspace_id_workspace_id_fk": { + "name": "resource_relationship_workspace_id_workspace_id_fk", + "tableFrom": "resource_relationship", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_schema": { + "name": "resource_schema", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "json_schema": { + "name": "json_schema", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "resource_schema_version_kind_workspace_id_index": { + "name": "resource_schema_version_kind_workspace_id_index", + "columns": [ + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_schema_workspace_id_workspace_id_fk": { + "name": "resource_schema_workspace_id_workspace_id_fk", + "tableFrom": "resource_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_variable": { + "name": "resource_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "resource_variable_resource_id_key_index": { + "name": "resource_variable_resource_id_key_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_variable_resource_id_resource_id_fk": { + "name": "resource_variable_resource_id_resource_id_fk", + "tableFrom": "resource_variable", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_view": { + "name": "resource_view", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "filter": { + "name": "filter", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "resource_view_workspace_id_workspace_id_fk": { + "name": "resource_view_workspace_id_workspace_id_fk", + "tableFrom": "resource_view", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.azure_tenant": { + "name": "azure_tenant", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "azure_tenant_tenant_id_index": { + "name": "azure_tenant_tenant_id_index", + "columns": [ + { + "expression": "tenant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "azure_tenant_workspace_id_workspace_id_fk": { + "name": "azure_tenant_workspace_id_workspace_id_fk", + "tableFrom": "azure_tenant", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_provider": { + "name": "resource_provider", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "resource_provider_workspace_id_name_index": { + "name": "resource_provider_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_workspace_id_workspace_id_fk": { + "name": "resource_provider_workspace_id_workspace_id_fk", + "tableFrom": "resource_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_provider_aws": { + "name": "resource_provider_aws", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_provider_id": { + "name": "resource_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "aws_role_arns": { + "name": "aws_role_arns", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "import_eks": { + "name": "import_eks", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "import_vpc": { + "name": "import_vpc", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "resource_provider_aws_resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_aws_resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource_provider_aws", + "tableTo": "resource_provider", + "columnsFrom": ["resource_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_provider_azure": { + "name": "resource_provider_azure", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_provider_id": { + "name": "resource_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tenant_id": { + "name": "tenant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subscription_id": { + "name": "subscription_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "resource_provider_azure_resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_azure_resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource_provider_azure", + "tableTo": "resource_provider", + "columnsFrom": ["resource_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "resource_provider_azure_tenant_id_azure_tenant_id_fk": { + "name": "resource_provider_azure_tenant_id_azure_tenant_id_fk", + "tableFrom": "resource_provider_azure", + "tableTo": "azure_tenant", + "columnsFrom": ["tenant_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.resource_provider_google": { + "name": "resource_provider_google", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_provider_id": { + "name": "resource_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_ids": { + "name": "project_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "import_gke": { + "name": "import_gke", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "import_namespaces": { + "name": "import_namespaces", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "import_vcluster": { + "name": "import_vcluster", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "import_vms": { + "name": "import_vms", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "import_vpc": { + "name": "import_vpc", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "resource_provider_google_resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_google_resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource_provider_google", + "tableTo": "resource_provider", + "columnsFrom": ["resource_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_version": { + "name": "deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "deployment_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'ready'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "deployment_version_deployment_id_tag_index": { + "name": "deployment_version_deployment_id_tag_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "tag", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_version_created_at_idx": { + "name": "deployment_version_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_version_deployment_id_deployment_id_fk": { + "name": "deployment_version_deployment_id_deployment_id_fk", + "tableFrom": "deployment_version", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_version_channel": { + "name": "deployment_version_channel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_version_selector": { + "name": "deployment_version_selector", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "deployment_version_channel_deployment_id_name_index": { + "name": "deployment_version_channel_deployment_id_name_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_version_channel_deployment_id_deployment_id_fk": { + "name": "deployment_version_channel_deployment_id_deployment_id_fk", + "tableFrom": "deployment_version_channel", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_version_dependency": { + "name": "deployment_version_dependency", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_version_selector": { + "name": "deployment_version_selector", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "deployment_version_dependency_deployment_version_id_deployment_id_index": { + "name": "deployment_version_dependency_deployment_version_id_deployment_id_index", + "columns": [ + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_version_dependency_deployment_version_id_deployment_version_id_fk": { + "name": "deployment_version_dependency_deployment_version_id_deployment_version_id_fk", + "tableFrom": "deployment_version_dependency", + "tableTo": "deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_version_dependency_deployment_id_deployment_id_fk": { + "name": "deployment_version_dependency_deployment_id_deployment_id_fk", + "tableFrom": "deployment_version_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release_job_trigger": { + "name": "release_job_trigger", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "release_job_trigger_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "caused_by_id": { + "name": "caused_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "release_job_trigger_job_id_job_id_fk": { + "name": "release_job_trigger_job_id_job_id_fk", + "tableFrom": "release_job_trigger", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "release_job_trigger_caused_by_id_user_id_fk": { + "name": "release_job_trigger_caused_by_id_user_id_fk", + "tableFrom": "release_job_trigger", + "tableTo": "user", + "columnsFrom": ["caused_by_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "release_job_trigger_deployment_version_id_deployment_version_id_fk": { + "name": "release_job_trigger_deployment_version_id_deployment_version_id_fk", + "tableFrom": "release_job_trigger", + "tableTo": "deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_job_trigger_resource_id_resource_id_fk": { + "name": "release_job_trigger_resource_id_resource_id_fk", + "tableFrom": "release_job_trigger", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_job_trigger_environment_id_environment_id_fk": { + "name": "release_job_trigger_environment_id_environment_id_fk", + "tableFrom": "release_job_trigger", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "release_job_trigger_job_id_unique": { + "name": "release_job_trigger_job_id_unique", + "nullsNotDistinct": false, + "columns": ["job_id"] + } + } + }, + "public.deployment_version_metadata": { + "name": "deployment_version_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_version_id": { + "name": "deployment_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_version_metadata_key_deployment_version_id_index": { + "name": "deployment_version_metadata_key_deployment_version_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_version_metadata_deployment_version_id_deployment_version_id_fk": { + "name": "deployment_version_metadata_deployment_version_id_deployment_version_id_fk", + "tableFrom": "deployment_version_metadata", + "tableTo": "deployment_version", + "columnsFrom": ["deployment_version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.system": { + "name": "system", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "system_workspace_id_slug_index": { + "name": "system_workspace_id_slug_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook": { + "name": "runbook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "runbook_system_id_system_id_fk": { + "name": "runbook_system_id_system_id_fk", + "tableFrom": "runbook", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "runbook_job_agent_id_job_agent_id_fk": { + "name": "runbook_job_agent_id_job_agent_id_fk", + "tableFrom": "runbook", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook_job_trigger": { + "name": "runbook_job_trigger", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "runbook_job_trigger_job_id_job_id_fk": { + "name": "runbook_job_trigger_job_id_job_id_fk", + "tableFrom": "runbook_job_trigger", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "runbook_job_trigger_runbook_id_runbook_id_fk": { + "name": "runbook_job_trigger_runbook_id_runbook_id_fk", + "tableFrom": "runbook_job_trigger", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "runbook_job_trigger_job_id_unique": { + "name": "runbook_job_trigger_job_id_unique", + "nullsNotDistinct": false, + "columns": ["job_id"] + } + } + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": [ + { + "expression": "team_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job": { + "name": "job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "job_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "job_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'policy_passing'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "job_created_at_idx": { + "name": "job_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_status_idx": { + "name": "job_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_job_agent_id_job_agent_id_fk": { + "name": "job_job_agent_id_job_agent_id_fk", + "tableFrom": "job", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_metadata": { + "name": "job_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_metadata_key_job_id_index": { + "name": "job_metadata_key_job_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_metadata_job_id_job_id_fk": { + "name": "job_metadata_job_id_job_id_fk", + "tableFrom": "job_metadata", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_variable": { + "name": "job_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "job_variable_job_id_key_index": { + "name": "job_variable_job_id_key_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_variable_job_id_job_id_fk": { + "name": "job_variable_job_id_job_id_fk", + "tableFrom": "job_variable", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "google_service_account_email": { + "name": "google_service_account_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "aws_role_arn": { + "name": "aws_role_arn", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.workspace_email_domain_matching": { + "name": "workspace_email_domain_matching", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "verification_code": { + "name": "verification_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verification_email": { + "name": "verification_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_email_domain_matching_workspace_id_domain_index": { + "name": "workspace_email_domain_matching_workspace_id_domain_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_email_domain_matching_workspace_id_workspace_id_fk": { + "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_email_domain_matching_role_id_role_id_fk": { + "name": "workspace_email_domain_matching_role_id_role_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.variable_set": { + "name": "variable_set", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "variable_set_system_id_system_id_fk": { + "name": "variable_set_system_id_system_id_fk", + "tableFrom": "variable_set", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.variable_set_environment": { + "name": "variable_set_environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_set_id": { + "name": "variable_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "variable_set_environment_variable_set_id_variable_set_id_fk": { + "name": "variable_set_environment_variable_set_id_variable_set_id_fk", + "tableFrom": "variable_set_environment", + "tableTo": "variable_set", + "columnsFrom": ["variable_set_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "variable_set_environment_environment_id_environment_id_fk": { + "name": "variable_set_environment_environment_id_environment_id_fk", + "tableFrom": "variable_set_environment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.variable_set_value": { + "name": "variable_set_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_set_id": { + "name": "variable_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "variable_set_value_variable_set_id_key_index": { + "name": "variable_set_value_variable_set_id_key_index", + "columns": [ + { + "expression": "variable_set_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "variable_set_value_variable_set_id_variable_set_id_fk": { + "name": "variable_set_value_variable_set_id_variable_set_id_fk", + "tableFrom": "variable_set_value", + "tableTo": "variable_set", + "columnsFrom": ["variable_set_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace_invite_token": { + "name": "workspace_invite_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_invite_token_role_id_role_id_fk": { + "name": "workspace_invite_token_role_id_role_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_workspace_id_workspace_id_fk": { + "name": "workspace_invite_token_workspace_id_workspace_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_created_by_user_id_fk": { + "name": "workspace_invite_token_created_by_user_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_token_token_unique": { + "name": "workspace_invite_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.resource_metadata_group": { + "name": "resource_metadata_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "keys": { + "name": "keys", + "type": "text[]", + "primaryKey": false, + "notNull": true + }, + "include_null_combinations": { + "name": "include_null_combinations", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "resource_metadata_group_workspace_id_workspace_id_fk": { + "name": "resource_metadata_group_workspace_id_workspace_id_fk", + "tableFrom": "resource_metadata_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook_variable": { + "name": "runbook_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "runbook_variable_runbook_id_key_index": { + "name": "runbook_variable_runbook_id_key_index", + "columns": [ + { + "expression": "runbook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "runbook_variable_runbook_id_runbook_id_fk": { + "name": "runbook_variable_runbook_id_runbook_id_fk", + "tableFrom": "runbook_variable", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.entity_role": { + "name": "entity_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "scope_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": { + "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "entity_role_role_id_role_id_fk": { + "name": "entity_role_role_id_role_id_fk", + "tableFrom": "entity_role", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "role_workspace_id_workspace_id_fk": { + "name": "role_workspace_id_workspace_id_fk", + "tableFrom": "role", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role_permission": { + "name": "role_permission", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "role_permission_role_id_permission_index": { + "name": "role_permission_role_id_permission_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "role_permission_role_id_role_id_fk": { + "name": "role_permission_role_id_role_id_fk", + "tableFrom": "role_permission", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_agent": { + "name": "job_agent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "job_agent_workspace_id_name_index": { + "name": "job_agent_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_deployment_version_channel": { + "name": "environment_policy_deployment_version_channel", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "channel_id": { + "name": "channel_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_policy_deployment_version_channel_policy_id_channel_id_index": { + "name": "environment_policy_deployment_version_channel_policy_id_channel_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "channel_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "environment_policy_deployment_version_channel_policy_id_deployment_id_index": { + "name": "environment_policy_deployment_version_channel_policy_id_deployment_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk": { + "name": "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_deployment_version_channel", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk": { + "name": "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk", + "tableFrom": "environment_policy_deployment_version_channel", + "tableTo": "deployment_version_channel", + "columnsFrom": ["channel_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk": { + "name": "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk", + "tableFrom": "environment_policy_deployment_version_channel", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "public.system_role": { + "name": "system_role", + "schema": "public", + "values": ["user", "admin"] + }, + "public.environment_policy_approval_requirement": { + "name": "environment_policy_approval_requirement", + "schema": "public", + "values": ["manual", "automatic"] + }, + "public.approval_status_type": { + "name": "approval_status_type", + "schema": "public", + "values": ["pending", "approved", "rejected"] + }, + "public.environment_policy_deployment_success_type": { + "name": "environment_policy_deployment_success_type", + "schema": "public", + "values": ["all", "some", "optional"] + }, + "public.recurrence_type": { + "name": "recurrence_type", + "schema": "public", + "values": ["hourly", "daily", "weekly", "monthly"] + }, + "public.release_sequencing_type": { + "name": "release_sequencing_type", + "schema": "public", + "values": ["wait", "cancel"] + }, + "public.github_entity_type": { + "name": "github_entity_type", + "schema": "public", + "values": ["organization", "user"] + }, + "public.resource_relationship_type": { + "name": "resource_relationship_type", + "schema": "public", + "values": ["associated_with", "depends_on"] + }, + "public.release_job_trigger_type": { + "name": "release_job_trigger_type", + "schema": "public", + "values": [ + "new_release", + "release_updated", + "new_resource", + "resource_changed", + "api", + "redeploy", + "force_deploy", + "new_environment", + "variable_changed", + "retry" + ] + }, + "public.deployment_version_status": { + "name": "deployment_version_status", + "schema": "public", + "values": ["building", "ready", "failed"] + }, + "public.job_reason": { + "name": "job_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override" + ] + }, + "public.job_status": { + "name": "job_status", + "schema": "public", + "values": [ + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found", + "successful" + ] + }, + "public.entity_type": { + "name": "entity_type", + "schema": "public", + "values": ["user", "team"] + }, + "public.scope_type": { + "name": "scope_type", + "schema": "public", + "values": [ + "release", + "releaseChannel", + "resource", + "resourceProvider", + "resourceMetadataGroup", + "workspace", + "environment", + "environmentPolicy", + "deploymentVariable", + "variableSet", + "system", + "deployment", + "job", + "jobAgent", + "runbook", + "resourceView" + ] + } + }, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 910be8ee9..f64ac7cec 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -526,6 +526,13 @@ "when": 1741026605759, "tag": "0074_nebulous_mantis", "breakpoints": true + }, + { + "idx": 75, + "version": "7", + "when": 1741759085793, + "tag": "0075_safe_red_wolf", + "breakpoints": true } ] } diff --git a/packages/db/src/schema/release-channel.ts b/packages/db/src/schema/release-channel.ts index a14113d7c..a42a0d6b6 100644 --- a/packages/db/src/schema/release-channel.ts +++ b/packages/db/src/schema/release-channel.ts @@ -6,7 +6,7 @@ import { environmentPolicy } from "./environment.js"; import { releaseChannel } from "./release.js"; export const environmentPolicyReleaseChannel = pgTable( - "environment_policy_release_channel", + "environment_policy_deployment_version_channel", { id: uuid("id").primaryKey().defaultRandom(), policyId: uuid("policy_id") diff --git a/packages/db/src/schema/release.ts b/packages/db/src/schema/release.ts index 46dcc1501..6f7360ea1 100644 --- a/packages/db/src/schema/release.ts +++ b/packages/db/src/schema/release.ts @@ -53,7 +53,7 @@ import { job } from "./job.js"; import { resource } from "./resource.js"; export const releaseChannel = pgTable( - "release_channel", + "deployment_version_channel", { id: uuid("id").primaryKey().defaultRandom(), name: text("name").notNull(), @@ -61,7 +61,7 @@ export const releaseChannel = pgTable( deploymentId: uuid("deployment_id") .notNull() .references(() => deployment.id, { onDelete: "cascade" }), - releaseFilter: jsonb("release_filter") + releaseFilter: jsonb("deployment_version_selector") .$type() .default(sql`NULL`), }, @@ -75,16 +75,16 @@ export const createReleaseChannel = createInsertSchema(releaseChannel, { export const updateReleaseChannel = createReleaseChannel.partial(); export const releaseDependency = pgTable( - "release_dependency", + "deployment_version_dependency", { id: uuid("id").primaryKey().defaultRandom(), - releaseId: uuid("release_id") + releaseId: uuid("deployment_version_id") .notNull() .references(() => release.id, { onDelete: "cascade" }), deploymentId: uuid("deployment_id") .notNull() .references(() => deployment.id, { onDelete: "cascade" }), - releaseFilter: jsonb("release_filter") + releaseFilter: jsonb("deployment_version_selector") .$type() .default(sql`NULL`), }, @@ -97,18 +97,18 @@ const createReleaseDependency = createInsertSchema(releaseDependency, { releaseFilter: releaseCondition, }).omit({ id: true }); -export const releaseStatus = pgEnum("release_status", [ +export const releaseStatus = pgEnum("deployment_version_status", [ "building", "ready", "failed", ]); export const release = pgTable( - "release", + "deployment_version", { id: uuid("id").primaryKey().defaultRandom(), name: text("name").notNull(), - version: text("version").notNull(), + version: text("tag").notNull(), config: jsonb("config") .notNull() .default("{}") @@ -126,7 +126,7 @@ export const release = pgTable( }, (t) => ({ unq: uniqueIndex().on(t.deploymentId, t.version), - createdAtIdx: index("release_created_at_idx").on(t.createdAt), + createdAtIdx: index("deployment_version_created_at_idx").on(t.createdAt), }), ); @@ -153,10 +153,10 @@ export const createRelease = createInsertSchema(release, { export const updateRelease = createRelease.partial(); export type UpdateRelease = z.infer; export const releaseMetadata = pgTable( - "release_metadata", + "deployment_version_metadata", { id: uuid("id").primaryKey().defaultRandom().notNull(), - releaseId: uuid("release_id") + releaseId: uuid("deployment_version_id") .references(() => release.id, { onDelete: "cascade" }) .notNull(), key: text("key").notNull(), @@ -191,7 +191,7 @@ export const releaseJobTrigger = pgTable( type: releaseJobTriggerType("type").notNull(), causedById: uuid("caused_by_id").references(() => user.id), - releaseId: uuid("release_id") + releaseId: uuid("deployment_version_id") .references(() => release.id, { onDelete: "cascade" }) .notNull(), resourceId: uuid("resource_id") diff --git a/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts b/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts index 7c0ce1dfc..76fc3c758 100644 --- a/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts +++ b/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts @@ -69,7 +69,7 @@ const resource: SCHEMA.Resource = { deletedAt: null, }; -const release: SCHEMA.Release = { +const deployment_version: SCHEMA.Release = { id: "0", name: "test", config: {}, @@ -104,7 +104,7 @@ const variableValues: SCHEMA.DeploymentVariableValue[] = [ type variable = { deployment_variable: SCHEMA.DeploymentVariable; - release: SCHEMA.Release; + deployment_version: SCHEMA.Release; }; describe("job-variables-deployment", () => { @@ -123,7 +123,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: "0", }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -161,7 +161,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: "0", }, - release, + deployment_version, }, ]; vi.mocked(utils.getDeploymentVariables).mockResolvedValue(variables); @@ -196,7 +196,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: null, }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -231,7 +231,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: "0", }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -301,7 +301,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: "0", }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -370,7 +370,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: "0", }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -437,7 +437,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: null, }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -504,7 +504,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: null, }, - release, + deployment_version, }, ]; vi.mocked(utils.getResourceVariableValue).mockResolvedValue(null); @@ -598,7 +598,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: null, }, - release, + deployment_version, }, ]; @@ -695,7 +695,7 @@ describe("job-variables-deployment", () => { key: "test", defaultValueId: null, }, - release, + deployment_version, }, ]; diff --git a/packages/job-dispatch/src/job-creation.ts b/packages/job-dispatch/src/job-creation.ts index 1d6d96c74..f139a4868 100644 --- a/packages/job-dispatch/src/job-creation.ts +++ b/packages/job-dispatch/src/job-creation.ts @@ -93,7 +93,7 @@ export const onJobCompletion = async (je: schema.Job) => { .then(takeFirst); const isDependentOnTriggerForCriteria = and( - eq(schema.releaseJobTrigger.releaseId, triggers.release.id), + eq(schema.releaseJobTrigger.releaseId, triggers.deployment_version.id), eq( schema.environmentPolicyDeployment.environmentId, triggers.release_job_trigger.environmentId, @@ -103,7 +103,7 @@ export const onJobCompletion = async (je: schema.Job) => { const isWaitingOnConcurrencyRequirementInSameRelease = and( isNotNull(schema.environmentPolicy.concurrencyLimit), eq(schema.environmentPolicy.id, triggers.environment.policyId), - eq(schema.release.deploymentId, triggers.release.deploymentId), + eq(schema.release.deploymentId, triggers.deployment_version.deploymentId), eq(schema.job.status, JobStatus.Pending), ); @@ -114,7 +114,7 @@ export const onJobCompletion = async (je: schema.Job) => { const isWaitingOnJobToFinish = and( eq(schema.environment.id, triggers.release_job_trigger.environmentId), eq(schema.deployment.id, triggers.deployment.id), - ne(schema.release.id, triggers.release.id), + ne(schema.release.id, triggers.deployment_version.id), ); const affectedReleaseJobTriggers = await db diff --git a/packages/job-dispatch/src/job-failure.ts b/packages/job-dispatch/src/job-failure.ts index 0d2c466d8..25b4979c4 100644 --- a/packages/job-dispatch/src/job-failure.ts +++ b/packages/job-dispatch/src/job-failure.ts @@ -29,7 +29,7 @@ export const onJobFailure = async (job: schema.Job) => { .from(schema.releaseJobTrigger) .where( and( - eq(schema.releaseJobTrigger.releaseId, jobInfo.release.id), + eq(schema.releaseJobTrigger.releaseId, jobInfo.deployment_version.id), eq( schema.releaseJobTrigger.environmentId, jobInfo.release_job_trigger.environmentId, @@ -48,7 +48,7 @@ export const onJobFailure = async (job: schema.Job) => { if (releaseJobTriggerCount >= jobInfo.deployment.retryCount) return; const createTrigger = createReleaseJobTriggers(db, "retry") - .releases([jobInfo.release.id]) + .releases([jobInfo.deployment_version.id]) .resources([jobInfo.release_job_trigger.resourceId]) .environments([jobInfo.release_job_trigger.environmentId]); @@ -65,7 +65,7 @@ export const onJobFailure = async (job: schema.Job) => { .dispatch() .then(() => logger.info( - `Retry job for release ${jobInfo.release.id} and resource ${jobInfo.release_job_trigger.resourceId} created and dispatched.`, + `Retry job for deployment version ${jobInfo.deployment_version.id} and resource ${jobInfo.release_job_trigger.resourceId} created and dispatched.`, ), ); }; diff --git a/packages/job-dispatch/src/policies/concurrency-policy.ts b/packages/job-dispatch/src/policies/concurrency-policy.ts index 2a1a826de..a8734f9d7 100644 --- a/packages/job-dispatch/src/policies/concurrency-policy.ts +++ b/packages/job-dispatch/src/policies/concurrency-policy.ts @@ -43,9 +43,12 @@ export const isPassingConcurrencyPolicy: ReleaseIdPolicyChecker = async ( ) .then((rows) => _.chain(rows) - .groupBy((r) => [r.release.deploymentId, r.environment.policyId]) + .groupBy((r) => [ + r.deployment_version.deploymentId, + r.environment.policyId, + ]) .map((groupedTriggers) => ({ - deploymentId: groupedTriggers[0]!.release.deploymentId, + deploymentId: groupedTriggers[0]!.deployment_version.deploymentId, policyId: groupedTriggers[0]!.environment.policyId, concurrencyLimit: groupedTriggers[0]!.environment_policy.concurrencyLimit, diff --git a/packages/job-dispatch/src/policies/gradual-rollout.ts b/packages/job-dispatch/src/policies/gradual-rollout.ts index 141ee49aa..4485459fd 100644 --- a/packages/job-dispatch/src/policies/gradual-rollout.ts +++ b/packages/job-dispatch/src/policies/gradual-rollout.ts @@ -97,7 +97,11 @@ export const isPassingJobRolloutPolicy: ReleaseIdPolicyChecker = async ( return Promise.all( policies.map(async (p) => { - const { release_job_trigger, environment_policy, release } = p; + const { + release_job_trigger, + environment_policy, + deployment_version: release, + } = p; if ( environment_policy == null || environment_policy.rolloutDuration === 0 diff --git a/packages/job-dispatch/src/policies/release-dependency.ts b/packages/job-dispatch/src/policies/release-dependency.ts index e8d8b2743..34eb4677b 100644 --- a/packages/job-dispatch/src/policies/release-dependency.ts +++ b/packages/job-dispatch/src/policies/release-dependency.ts @@ -26,7 +26,7 @@ export const isPassingReleaseDependencyPolicy = async ( if (release.length === 0) return trigger; - const deps = release.map((r) => r.release_dependency); + const deps = release.map((r) => r.deployment_version_dependency); if (deps.length === 0) return trigger; diff --git a/packages/job-dispatch/src/policies/release-sequencing.ts b/packages/job-dispatch/src/policies/release-sequencing.ts index a2a561916..2b00b1ab5 100644 --- a/packages/job-dispatch/src/policies/release-sequencing.ts +++ b/packages/job-dispatch/src/policies/release-sequencing.ts @@ -51,7 +51,7 @@ export const isPassingNoActiveJobsPolicy: ReleaseIdPolicyChecker = async ( db.execute(sql` select 1 from ${schema.job} inner join ${schema.releaseJobTrigger} as rjt2 on ${schema.job.id} = rjt2.job_id - inner join ${schema.release} as release2 on rjt2.release_id = release2.id + inner join ${schema.release} as release2 on rjt2.deployment_version_id = release2.id inner join ${schema.resource} on rjt2.resource_id = ${schema.resource.id} where rjt2.environment_id = ${schema.releaseJobTrigger.environmentId} and release2.deployment_id = ${schema.deployment.id} @@ -71,10 +71,13 @@ export const isPassingNoActiveJobsPolicy: ReleaseIdPolicyChecker = async ( ]) .flatMap((rjt) => { const maxRelease = _.maxBy(rjt, (rjt) => [ - rjt.release.createdAt, - rjt.release.version, + rjt.deployment_version.createdAt, + rjt.deployment_version.version, ]); - return rjt.filter((rjt) => rjt.release.id === maxRelease?.release.id); + return rjt.filter( + (rjt) => + rjt.deployment_version.id === maxRelease?.deployment_version.id, + ); }) .map((rjt) => rjt.release_job_trigger) .value(); @@ -156,8 +159,8 @@ const isReleaseLatestActiveForEnvironment = async ( if (!latestActiveRelease) return true; return ( - release.id === latestActiveRelease.release.id || - isAfter(release.createdAt, latestActiveRelease.release.createdAt) + release.id === latestActiveRelease.deployment_version.id || + isAfter(release.createdAt, latestActiveRelease.deployment_version.createdAt) ); }; diff --git a/packages/job-dispatch/src/policies/success-rate-criteria-passing.ts b/packages/job-dispatch/src/policies/success-rate-criteria-passing.ts index 80303bdf0..d408087c1 100644 --- a/packages/job-dispatch/src/policies/success-rate-criteria-passing.ts +++ b/packages/job-dispatch/src/policies/success-rate-criteria-passing.ts @@ -91,7 +91,7 @@ export const isPassingCriteriaPolicy: ReleaseIdPolicyChecker = async ( const isPassing = await isSuccessCriteriaPassing( db, policy.environment_policy, - policy.release, + policy.deployment_version, ); return isPassing ? policy.release_job_trigger : null; diff --git a/packages/job-dispatch/src/policy-create.ts b/packages/job-dispatch/src/policy-create.ts index 48ff72412..446153ae4 100644 --- a/packages/job-dispatch/src/policy-create.ts +++ b/packages/job-dispatch/src/policy-create.ts @@ -41,7 +41,7 @@ export const createJobApprovals = async ( .values( policiesToCheck.map((p) => ({ policyId: p.environment_policy.id, - releaseId: p.release.id, + releaseId: p.deployment_version.id, })), ) .onConflictDoNothing(); diff --git a/packages/job-dispatch/src/release-job-trigger.ts b/packages/job-dispatch/src/release-job-trigger.ts index 2ca49111c..64bdbe231 100644 --- a/packages/job-dispatch/src/release-job-trigger.ts +++ b/packages/job-dispatch/src/release-job-trigger.ts @@ -174,7 +174,8 @@ class ReleaseJobTriggerBuilder { causedById: this._causedById, resourceId: v.resource.id, environmentId: v.environment.id, - releaseId: v.release.id, + releaseId: + "deployment_version" in v ? v.deployment_version.id : v.release.id, jobId: "", })); @@ -196,7 +197,9 @@ class ReleaseJobTriggerBuilder { const jobInserts = wt .map((t) => { - const release = releases.find((r) => r.release.id === t.releaseId); + const release = releases.find( + (r) => r.deployment_version.id === t.releaseId, + ); if (!release) return null; return { jobAgentId: release.job_agent.id, diff --git a/packages/node-sdk/src/index.ts b/packages/node-sdk/src/index.ts index 075012fe6..91c237c5f 100644 --- a/packages/node-sdk/src/index.ts +++ b/packages/node-sdk/src/index.ts @@ -79,7 +79,7 @@ export class JobAgent { ) {} private agent: - | operations["updateJobAgent"]["responses"]["200"]["content"]["application/json"] + | operations["upsertJobAgent"]["responses"]["200"]["content"]["application/json"] | null = null; async get() { diff --git a/packages/node-sdk/src/schema.ts b/packages/node-sdk/src/schema.ts index e11ab2b15..4db1bf912 100644 --- a/packages/node-sdk/src/schema.ts +++ b/packages/node-sdk/src/schema.ts @@ -4,6 +4,24 @@ */ export interface paths { + "/v1/deployments/{deploymentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a deployment */ + get: operations["getDeployment"]; + put?: never; + post?: never; + /** Delete a deployment */ + delete: operations["deleteDeployment"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/deployments/{deploymentId}/release-channels/name/{name}": { parameters: { query?: never; @@ -21,6 +39,23 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/deployments": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a deployment */ + post: operations["createDeployment"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/environments/{environmentId}": { parameters: { query?: never; @@ -64,7 +99,7 @@ export interface paths { cookie?: never; }; /** Get a agents running jobs */ - get: operations["getAgentRunningJob"]; + get: operations["getAgentRunningJobs"]; put?: never; post?: never; delete?: never; @@ -124,7 +159,7 @@ export interface paths { options?: never; head?: never; /** Upserts the agent */ - patch: operations["updateJobAgent"]; + patch: operations["upsertJobAgent"]; trace?: never; }; "/v1/jobs/{jobId}/acknowledge": { @@ -213,6 +248,23 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/releases/{releaseId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** Updates a release */ + patch: operations["updateRelease"]; + trace?: never; + }; "/v1/releases": { parameters: { query?: never; @@ -222,8 +274,8 @@ export interface paths { }; get?: never; put?: never; - /** Creates a release */ - post: operations["createRelease"]; + /** Upserts a release */ + post: operations["upsertRelease"]; delete?: never; options?: never; head?: never; @@ -311,6 +363,42 @@ export interface paths { get: operations["getSystem"]; put?: never; post?: never; + /** Delete a system */ + delete: operations["deleteSystem"]; + options?: never; + head?: never; + /** Update a system */ + patch: operations["updateSystem"]; + trace?: never; + }; + "/v1/systems": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** Create a system */ + post: operations["createSystem"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a workspace */ + get: operations["getWorkspace"]; + put?: never; + post?: never; delete?: never; options?: never; head?: never; @@ -334,6 +422,23 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/workspaces/{workspaceId}/resources/{filter}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get resources by filter */ + get: operations["getResourcesByFilter"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/workspaces/{workspaceId}/resources/identifier/{identifier}": { parameters: { query?: never; @@ -352,10 +457,84 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/workspaces/slug/{workspaceSlug}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Get a workspace by slug */ + get: operations["getWorkspaceBySlug"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; } export type webhooks = Record; export interface components { schemas: { + JobWithTrigger: components["schemas"]["Job"] & { + release?: components["schemas"]["Release"]; + deployment?: components["schemas"]["Deployment"]; + runbook?: components["schemas"]["Runbook"]; + resource?: components["schemas"]["Resource"]; + environment?: components["schemas"]["Environment"]; + variables: Record; + approval?: { + id: string; + /** @enum {string} */ + status: "pending" | "approved" | "rejected"; + /** @description Null when status is pending, contains approver details when approved or rejected */ + approver?: { + id: string; + name: string; + } | null; + } | null; + }; + Workspace: { + /** + * Format: uuid + * @description The workspace ID + */ + id: string; + /** @description The name of the workspace */ + name: string; + /** @description The slug of the workspace */ + slug: string; + /** + * @description The email of the Google service account attached to the workspace + * @example ctrlplane@ctrlplane-workspace.iam.gserviceaccount.com + */ + googleServiceAccountEmail?: string | null; + /** + * @description The ARN of the AWS role attached to the workspace + * @example arn:aws:iam::123456789012:role/ctrlplane-workspace-role + */ + awsRoleArn?: string | null; + }; + System: { + /** + * Format: uuid + * @description The system ID + */ + id: string; + /** + * Format: uuid + * @description The workspace ID of the system + */ + workspaceId: string; + /** @description The name of the system */ + name: string; + /** @description The slug of the system */ + slug: string; + /** @description The description of the system */ + description?: string; + }; Deployment: { /** Format: uuid */ id: string; @@ -378,6 +557,9 @@ export interface components { config: { [key: string]: unknown; }; + jobAgentConfig: { + [key: string]: unknown; + }; /** Format: uuid */ deploymentId: string; /** Format: date-time */ @@ -386,6 +568,45 @@ export interface components { [key: string]: unknown; }; }; + Policy: { + /** + * Format: uuid + * @description The policy ID + */ + id: string; + /** + * Format: uuid + * @description The system ID + */ + systemId: string; + /** @description The name of the policy */ + name: string; + /** @description The description of the policy */ + description?: string | null; + /** + * @description The approval requirement of the policy + * @enum {string} + */ + approvalRequirement: "manual" | "automatic"; + /** + * @description If a policy depends on an environment, whether or not the policy requires all, some, or optional successful releases in the environment + * @enum {string} + */ + successType: "some" | "all" | "optional"; + /** @description If a policy depends on an environment, the minimum number of successful releases in the environment */ + successMinimum: number; + /** @description The maximum number of concurrent releases in the environment */ + concurrencyLimit?: number | null; + /** @description The duration of the rollout in milliseconds */ + rolloutDuration: number; + /** @description The minimum interval between releases in milliseconds */ + minimumReleaseInterval: number; + /** + * @description If a new release is created, whether it will wait for the current release to finish before starting, or cancel the current release + * @enum {string} + */ + releaseSequencing: "wait" | "cancel"; + }; Environment: { /** Format: uuid */ id: string; @@ -398,10 +619,18 @@ export interface components { resourceFilter?: { [key: string]: unknown; } | null; + /** + * @description The directory path of the environment + * @default + * @example my/env/path + */ + directory: string; /** Format: date-time */ createdAt: string; - /** Format: date-time */ - expiresAt?: string | null; + metadata?: { + [key: string]: string; + }; + policy?: components["schemas"]["Policy"]; }; Runbook: { /** Format: uuid */ @@ -432,27 +661,32 @@ export interface components { /** Format: uuid */ workspaceId: string; }; + /** @enum {string} */ + JobStatus: + | "successful" + | "cancelled" + | "skipped" + | "in_progress" + | "action_required" + | "pending" + | "failure" + | "invalid_job_agent" + | "invalid_integration" + | "external_run_not_found"; Job: { /** Format: uuid */ id: string; - /** @enum {string} */ - status: - | "completed" - | "cancelled" - | "skipped" - | "in_progress" - | "action_required" - | "pending" - | "failure" - | "invalid_job_agent" - | "invalid_integration" - | "external_run_not_found"; + status: components["schemas"]["JobStatus"]; /** @description External job identifier (e.g. GitHub workflow run ID) */ externalId?: string | null; /** Format: date-time */ createdAt: string; /** Format: date-time */ updatedAt: string; + /** Format: date-time */ + startedAt?: string | null; + /** Format: date-time */ + completedAt?: string | null; /** Format: uuid */ jobAgentId?: string; /** @description Configuration for the Job Agent */ @@ -476,31 +710,28 @@ export interface components { } export type $defs = Record; export interface operations { - deleteReleaseChannel: { + getDeployment: { parameters: { query?: never; header?: never; path: { deploymentId: string; - name: string; }; cookie?: never; }; requestBody?: never; responses: { - /** @description Release channel deleted */ + /** @description Deployment found */ 200: { headers: { [name: string]: unknown; }; content: { - "application/json": { - message: string; - }; + "application/json": components["schemas"]["Deployment"]; }; }; - /** @description Permission denied */ - 403: { + /** @description Deployment not found */ + 404: { headers: { [name: string]: unknown; }; @@ -510,7 +741,29 @@ export interface operations { }; }; }; - /** @description Release channel not found */ + }; + }; + deleteDeployment: { + parameters: { + query?: never; + header?: never; + path: { + deploymentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Deployment deleted */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Deployment"]; + }; + }; + /** @description Deployment not found */ 404: { headers: { [name: string]: unknown; @@ -521,7 +774,7 @@ export interface operations { }; }; }; - /** @description Failed to delete release channel */ + /** @description Failed to delete deployment */ 500: { headers: { [name: string]: unknown; @@ -534,149 +787,270 @@ export interface operations { }; }; }; - getEnvironment: { + deleteReleaseChannel: { parameters: { query?: never; header?: never; path: { - /** @description UUID of the environment */ - environmentId: string; + deploymentId: string; + name: string; }; cookie?: never; }; requestBody?: never; responses: { - /** @description Successful response */ + /** @description Release channel deleted */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { - id: string; - systemId: string; - name: string; - description?: string | null; - resourceFilter?: { - [key: string]: unknown; - }; - policyId?: string | null; - /** Format: date-time */ - expiresAt?: string; - /** Format: date-time */ - createdAt: string; - releaseChannels: { - id?: string; - deploymentId?: string; - channelId?: string; - environmentId?: string; - }[]; - policy?: { - systemId?: string; - name?: string; - description?: string | null; - id?: string; - /** @enum {string} */ - approvalRequirement?: "manual" | "automatic"; - /** @enum {string} */ - successType?: "some" | "all" | "optional"; - successMinimum?: number; - concurrencyLimit?: number | null; - rolloutDuration?: number; - /** @enum {string} */ - releaseSequencing?: "wait" | "cancel"; - } | null; + message: string; }; }; }; - /** @description Environment not found */ - 404: { + /** @description Permission denied */ + 403: { headers: { [name: string]: unknown; }; content: { "application/json": { - /** @example Environment not found */ error: string; }; }; }; - }; - }; - deleteEnvironment: { - parameters: { - query?: never; - header?: never; - path: { - /** @description UUID of the environment */ - environmentId: string; + /** @description Release channel not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; }; - cookie?: never; - }; - requestBody?: never; - responses: { - /** @description Environment deleted successfully */ - 200: { + /** @description Failed to delete release channel */ + 500: { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": { + error: string; + }; + }; }; }; }; - createEnvironment: { + createDeployment: { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; - requestBody: { + requestBody?: { content: { "application/json": { + /** + * Format: uuid + * @description The ID of the system to create the deployment for + * @example 123e4567-e89b-12d3-a456-426614174000 + */ systemId: string; + /** + * @description The name of the deployment + * @example My Deployment + */ name: string; + /** + * @description The slug of the deployment + * @example my-deployment + */ + slug: string; + /** + * @description The description of the deployment + * @example This is a deployment for my system + */ description?: string; - resourceFilter?: { - [key: string]: unknown; - }; - policyId?: string; - releaseChannels?: string[]; - /** Format: date-time */ - expiresAt?: string; + /** + * Format: uuid + * @description The ID of the job agent to use for the deployment + * @example 123e4567-e89b-12d3-a456-426614174000 + */ + jobAgentId?: string; + /** + * @description The configuration for the job agent + * @example { + * "key": "value" + * } + */ + jobAgentConfig?: Record; + /** + * @description The number of times to retry the deployment + * @example 3 + */ + retryCount?: number; + /** + * @description The timeout for the deployment + * @example 60 + */ + timeout?: number; + /** + * @description The resource filter for the deployment + * @example { + * "key": "value" + * } + */ + resourceFilter?: Record; }; }; }; responses: { - /** @description Environment created successfully */ - 200: { + /** @description Deployment created */ + 201: { headers: { [name: string]: unknown; }; content: { - "application/json": { - id: string; - systemId: string; - name: string; - description?: string | null; - /** Format: date-time */ - expiresAt?: string | null; - resourceFilter?: { - [key: string]: unknown; - }; - }; + "application/json": components["schemas"]["Deployment"]; }; }; - /** @description Environment already exists */ + /** @description Deployment already exists */ 409: { headers: { [name: string]: unknown; }; content: { "application/json": { - error?: string; - id?: string; - }; + error: string; + /** Format: uuid */ + id: string; + }; + }; + }; + /** @description Failed to create deployment */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error: string; + }; + }; + }; + }; + }; + getEnvironment: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the environment */ + environmentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Environment"]; + }; + }; + /** @description Environment not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Environment not found */ + error: string; + }; + }; + }; + }; + }; + deleteEnvironment: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the environment */ + environmentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Environment deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + }; + }; + createEnvironment: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description The directory path of the environment + * @default + * @example my/env/path + */ + directory?: string; + systemId: string; + name: string; + description?: string; + resourceFilter?: { + [key: string]: unknown; + }; + policyId?: string; + releaseChannels?: string[]; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description Environment created successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Environment"]; + }; + }; + /** @description Environment already exists */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + id?: string; + }; }; }; /** @description Failed to create environment */ @@ -692,7 +1066,7 @@ export interface operations { }; }; }; - getAgentRunningJob: { + getAgentRunningJobs: { parameters: { query?: never; header?: never; @@ -710,20 +1084,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - id: string; - status: string; - message: string; - jobAgentId: string; - jobAgentConfig: Record; - externalId: string | null; - release?: components["schemas"]["Release"]; - deployment?: components["schemas"]["Deployment"]; - config: Record; - runbook?: components["schemas"]["Runbook"]; - resource?: components["schemas"]["Resource"]; - environment?: components["schemas"]["Environment"]; - }[]; + "application/json": components["schemas"]["Job"][]; }; }; }; @@ -747,7 +1108,7 @@ export interface operations { }; content: { "application/json": { - job?: Record; + job?: components["schemas"]["Job"]; }; }; }; @@ -794,21 +1155,13 @@ export interface operations { }; content: { "application/json": { - jobs?: { - /** @description The job ID */ - id: string; - status: string; - jobAgentId: string; - jobAgentConfig: Record; - message: string; - releaseJobTriggerId: string; - }[]; + jobs?: components["schemas"]["Job"][]; }; }; }; }; }; - updateJobAgent: { + upsertJobAgent: { parameters: { query?: never; header?: never; @@ -901,24 +1254,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["Job"] & { - release?: components["schemas"]["Release"]; - deployment?: components["schemas"]["Deployment"]; - runbook?: components["schemas"]["Runbook"]; - resource?: components["schemas"]["Resource"]; - environment?: components["schemas"]["Environment"]; - variables: Record; - approval?: { - id: string; - /** @enum {string} */ - status: "pending" | "approved" | "rejected"; - /** @description Null when status is pending, contains approver details when approved or rejected */ - approver?: { - id: string; - name: string; - } | null; - } | null; - }; + "application/json": components["schemas"]["JobWithTrigger"]; }; }; /** @description Not Found */ @@ -948,7 +1284,7 @@ export interface operations { requestBody: { content: { "application/json": { - status?: string; + status?: components["schemas"]["JobStatus"]; message?: string | null; externalId?: string | null; }; @@ -1234,7 +1570,52 @@ export interface operations { }; }; }; - createRelease: { + updateRelease: { + parameters: { + query?: never; + header?: never; + path: { + /** @description The release ID */ + releaseId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + version?: string; + deploymentId?: string; + /** Format: date-time */ + createdAt?: string; + name?: string; + config?: { + [key: string]: unknown; + }; + jobAgentConfig?: { + [key: string]: unknown; + }; + /** @enum {string} */ + status?: "ready" | "building" | "failed"; + message?: string; + metadata?: { + [key: string]: string; + }; + }; + }; + }; + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Release"]; + }; + }; + }; + }; + upsertRelease: { parameters: { query?: never; header?: never; @@ -1252,7 +1633,15 @@ export interface operations { config?: { [key: string]: unknown; }; - metadata?: components["schemas"]["Release"]["metadata"]; + jobAgentConfig?: { + [key: string]: unknown; + }; + /** @enum {string} */ + status?: "ready" | "building" | "failed"; + message?: string; + metadata?: { + [key: string]: string; + }; }; }; }; @@ -1263,11 +1652,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - id?: string; - version?: string; - metadata?: components["schemas"]["Release"]["metadata"]; - }; + "application/json": components["schemas"]["Release"]; }; }; /** @description Release already exists */ @@ -1616,45 +2001,237 @@ export interface operations { requestBody?: never; responses: { /** @description System retrieved successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"] & { + environments?: components["schemas"]["Environment"][]; + deployments?: components["schemas"]["Deployment"][]; + }; + }; + }; + }; + }; + deleteSystem: { + parameters: { + query?: never; + header?: never; + path: { + systemId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description System deleted successfully */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": { - id: string; - name: string; - slug: string; - description: string; - workspaceId: string; - environments: { - id?: string; - name?: string; - description?: string | null; - /** Format: date-time */ - expiresAt?: string | null; - /** Format: date-time */ - createdAt?: string; - systemId?: string; - policyId?: string | null; - resourceFilter?: { - [key: string]: unknown; - } | null; - }[]; - deployments: { - id?: string; - name?: string; - slug?: string; - description?: string; - systemId?: string; - jobAgentId?: string | null; - jobAgentConfig?: { - [key: string]: unknown; - }; + /** @example System deleted */ + message?: string; + }; + }; + }; + /** @description System not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example System not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal server error */ + error?: string; + }; + }; + }; + }; + }; + updateSystem: { + parameters: { + query?: never; + header?: never; + path: { + /** @description UUID of the system */ + systemId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description Name of the system */ + name?: string; + /** @description Slug of the system */ + slug?: string; + /** @description Description of the system */ + description?: string; + /** + * Format: uuid + * @description UUID of the workspace + */ + workspaceId?: string; + }; + }; + }; + responses: { + /** @description System updated successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"]; + }; + }; + /** @description System not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example System not found */ + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal server error */ + error?: string; + }; + }; + }; + }; + }; + createSystem: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** + * Format: uuid + * @description The workspace ID of the system + */ + workspaceId: string; + /** @description The name of the system */ + name: string; + /** @description The slug of the system */ + slug: string; + /** @description The description of the system */ + description?: string; + }; + }; + }; + responses: { + /** @description System created successfully */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["System"]; + }; + }; + /** @description Bad request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: { + /** @enum {string} */ + code: "invalid_type" | "invalid_literal" | "custom"; + message: string; + path: (string | number)[]; }[]; }; }; }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Internal Server Error */ + error?: string; + }; + }; + }; + }; + }; + getWorkspace: { + parameters: { + query?: never; + header?: never; + path: { + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Workspace found */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Workspace"]; + }; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; }; }; upsertResourceProvider: { @@ -1714,6 +2291,42 @@ export interface operations { }; }; }; + getResourcesByFilter: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description Filter to apply to the resources */ + filter: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Resources */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Resource"][]; + }; + }; + /** @description Invalid filter */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; getResourceByIdentifier: { parameters: { query?: never; @@ -1851,4 +2464,48 @@ export interface operations { }; }; }; + getWorkspaceBySlug: { + parameters: { + query?: never; + header?: never; + path: { + workspaceSlug: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Workspace found */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["Workspace"]; + }; + }; + /** @description Workspace not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + /** @description Internal server error */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + error?: string; + }; + }; + }; + }; + }; }