diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/nodes/EnvironmentNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/nodes/EnvironmentNode.tsx
index f5913a74d..03aad754f 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/nodes/EnvironmentNode.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/nodes/EnvironmentNode.tsx
@@ -1,4 +1,3 @@
-import type * as SCHEMA from "@ctrlplane/db/schema";
import type { NodeProps } from "reactflow";
import { IconPlant } from "@tabler/icons-react";
import { Handle, Position } from "reactflow";
@@ -12,7 +11,6 @@ import { VersionSelectorCheck } from "../checks/VersionSelector";
type EnvironmentNodeProps = NodeProps<{
workspaceId: string;
- policy?: SCHEMA.EnvironmentPolicy;
versionId: string;
versionTag: string;
deploymentId: string;
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/_components/EnvironmentTabs.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/_components/EnvironmentTabs.tsx
index 19df0dce1..d96cff906 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/_components/EnvironmentTabs.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/_components/EnvironmentTabs.tsx
@@ -23,12 +23,10 @@ export const EnvironmentTabs: React.FC = () => {
const overviewUrl = environmentUrls.overview();
const deploymentsUrl = environmentUrls.deployments();
const resourcesUrl = environmentUrls.resources();
- const policiesUrl = environmentUrls.policies();
const settingsUrl = environmentUrls.settings();
const pathname = usePathname();
const getInitialTab = () => {
- if (pathname === policiesUrl) return "policies";
if (pathname === resourcesUrl) return "resources";
if (pathname === deploymentsUrl) return "deployments";
if (pathname === baseUrl) return "overview";
@@ -44,7 +42,6 @@ export const EnvironmentTabs: React.FC = () => {
if (value === "overview") router.push(overviewUrl);
if (value === "deployments") router.push(deploymentsUrl);
if (value === "resources") router.push(resourcesUrl);
- if (value === "policies") router.push(policiesUrl);
if (value === "settings") router.push(settingsUrl);
setActiveTab(value);
};
@@ -55,7 +52,6 @@ export const EnvironmentTabs: React.FC = () => {
Overview
Deployments
Resources
- Policies
Settings
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/_components/EnvironmentDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/_components/EnvironmentDropdown.tsx
index 5531c6845..edc83909d 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/_components/EnvironmentDropdown.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/environments/_components/EnvironmentDropdown.tsx
@@ -5,7 +5,6 @@ import {
IconChartBar,
IconClipboardCopy,
IconExternalLink,
- IconLock,
IconRefresh,
IconSettings,
IconTrash,
@@ -96,14 +95,6 @@ export const EnvironmentDropdown: React.FC = ({
Settings
- router.push(environmentUrls.policies())}
- >
-
- Policies
-
-
router.push(environmentUrls.variables())}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/reactflow/edges.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/_components/reactflow/edges.ts
deleted file mode 100644
index b5d683380..000000000
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/_components/reactflow/edges.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import type * as SCHEMA from "@ctrlplane/db/schema";
-import { MarkerType } from "reactflow";
-import colors from "tailwindcss/colors";
-
-const markerEnd = {
- type: MarkerType.Arrow,
- color: colors.neutral[700],
-};
-
-export const createEdgesWhereEnvironmentHasNoPolicy = (
- envs: SCHEMA.Environment[],
- standalonePolicies: SCHEMA.EnvironmentPolicy[],
-) =>
- envs.map((e) => {
- const isUsingStandalonePolicy = standalonePolicies.some(
- (p) => p.id === e.policyId,
- );
- const source = isUsingStandalonePolicy ? e.policyId : "trigger";
- return {
- id: source + "-" + e.id,
- source,
- target: e.id,
- markerEnd,
- };
- });
-
-export const createEdgesFromPolicyToEnvironment = (
- envs: Array<{ id: string; policyId?: string | null }>,
-) =>
- envs.map((e) => ({
- id: `${e.policyId ?? "trigger"}-${e.id}`,
- source: e.policyId ?? "trigger",
- target: e.id,
- markerEnd,
- }));
-
-export const createEdgesFromPolicyDeployment = (
- policyDeployments: Array,
-) =>
- policyDeployments.map((p) => ({
- id: p.id,
- source: p.environmentId,
- target: p.policyId,
- markerEnd,
- }));
-
-export const createEdgesWherePolicyHasNoEnvironment = (
- policies: Array,
- policyDeployments: Array,
-) =>
- policies
- .filter((t) => !policyDeployments.some((p) => p.policyId === t.id))
- .map((e) => ({
- id: "trigger-" + e.id,
- source: "trigger",
- target: e.id,
- markerEnd,
- }));
diff --git a/apps/webservice/src/app/api/v1/environments/[environmentId]/route.ts b/apps/webservice/src/app/api/v1/environments/[environmentId]/route.ts
index 1065f0d76..524c7cdd4 100644
--- a/apps/webservice/src/app/api/v1/environments/[environmentId]/route.ts
+++ b/apps/webservice/src/app/api/v1/environments/[environmentId]/route.ts
@@ -23,7 +23,7 @@ export const GET = request()
const { environmentId } = await params;
const environment = await ctx.db.query.environment.findFirst({
where: eq(schema.environment.id, environmentId),
- with: { policy: true, metadata: true },
+ with: { metadata: true },
});
if (environment == null)
return NextResponse.json(
diff --git a/apps/webservice/src/app/api/v1/environments/openapi.ts b/apps/webservice/src/app/api/v1/environments/openapi.ts
index e9db26d92..d909224b3 100644
--- a/apps/webservice/src/app/api/v1/environments/openapi.ts
+++ b/apps/webservice/src/app/api/v1/environments/openapi.ts
@@ -38,15 +38,6 @@ export const openapi: Swagger.SwaggerV3 = {
type: "object",
additionalProperties: true,
},
- policyId: {
- type: "string",
- },
- releaseChannels: {
- type: "array",
- items: {
- type: "string",
- },
- },
metadata: {
type: "object",
additionalProperties: { type: "string" },
diff --git a/apps/webservice/src/app/urls.ts b/apps/webservice/src/app/urls.ts
index e153a45fd..69c6cda89 100644
--- a/apps/webservice/src/app/urls.ts
+++ b/apps/webservice/src/app/urls.ts
@@ -190,7 +190,6 @@ const environment = (params: EnvironmentParams) => {
return {
baseUrl: () => buildUrl(...base),
deployments: () => buildUrl(...base, "deployments"),
- policies: () => buildUrl(...base, "policies"),
resources: () => buildUrl(...base, "resources"),
variables: () => buildUrl(...base, "variables"),
settings: () => buildUrl(...base, "settings"),
diff --git a/packages/api/src/router/environment-approval.ts b/packages/api/src/router/environment-approval.ts
deleted file mode 100644
index 9acdddf2b..000000000
--- a/packages/api/src/router/environment-approval.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import { isPresent } from "ts-is-present";
-import { z } from "zod";
-
-import { and, eq, takeFirstOrNull } from "@ctrlplane/db";
-import * as SCHEMA from "@ctrlplane/db/schema";
-import { Permission } from "@ctrlplane/validators/auth";
-
-import { createTRPCRouter, protectedProcedure } from "../trpc";
-
-export const approvalRouter = createTRPCRouter({
- byDeploymentVersionId: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.DeploymentGet)
- .on({ type: "deploymentVersion", id: input.versionId }),
- })
- .input(
- z.object({
- versionId: z.string(),
- status: z.enum(["pending", "approved", "rejected"]).optional(),
- }),
- )
- .query(({ ctx, input }) =>
- ctx.db
- .select()
- .from(SCHEMA.environmentPolicyApproval)
- .innerJoin(
- SCHEMA.environmentPolicy,
- eq(
- SCHEMA.environmentPolicy.id,
- SCHEMA.environmentPolicyApproval.policyId,
- ),
- )
- .leftJoin(
- SCHEMA.user,
- eq(SCHEMA.user.id, SCHEMA.environmentPolicyApproval.userId),
- )
- .where(
- and(
- ...[
- eq(
- SCHEMA.environmentPolicyApproval.deploymentVersionId,
- input.versionId,
- ),
- input.status
- ? eq(SCHEMA.environmentPolicyApproval.status, input.status)
- : null,
- ].filter(isPresent),
- ),
- )
- .then((p) =>
- p.map((r) => ({
- ...r.environment_policy_approval,
- policy: r.environment_policy,
- user: r.user,
- })),
- ),
- ),
- statusByVersionPolicyId: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.DeploymentGet)
- .on({ type: "deploymentVersion", id: input.versionId }),
- })
- .input(
- z.object({ versionId: z.string().uuid(), policyId: z.string().uuid() }),
- )
- .query(({ ctx, input }) =>
- ctx.db
- .select()
- .from(SCHEMA.environmentPolicyApproval)
- .where(
- and(
- eq(
- SCHEMA.environmentPolicyApproval.deploymentVersionId,
- input.versionId,
- ),
- eq(SCHEMA.environmentPolicyApproval.policyId, input.policyId),
- ),
- )
- .then(takeFirstOrNull),
- ),
-});
diff --git a/packages/api/src/router/environment-page/deployments/deployment-stats.ts b/packages/api/src/router/environment-page/deployments/deployment-stats.ts
index 90e01be46..c6cfcb01a 100644
--- a/packages/api/src/router/environment-page/deployments/deployment-stats.ts
+++ b/packages/api/src/router/environment-page/deployments/deployment-stats.ts
@@ -82,31 +82,15 @@ export const getDeploymentStats = async (
].filter(isPresent),
};
- const row = await db
+ const version = await db
.select()
.from(SCHEMA.deploymentVersion)
- .leftJoin(
- SCHEMA.environmentPolicyApproval,
- and(
- eq(
- SCHEMA.environmentPolicyApproval.deploymentVersionId,
- SCHEMA.deploymentVersion.id,
- ),
- eq(SCHEMA.environmentPolicyApproval.policyId, environment.policyId),
- ),
- )
- .leftJoin(
- SCHEMA.user,
- eq(SCHEMA.environmentPolicyApproval.userId, SCHEMA.user.id),
- )
.where(and(eq(SCHEMA.deploymentVersion.deploymentId, deployment.id)))
.orderBy(desc(SCHEMA.deploymentVersion.createdAt))
.limit(1)
.then(takeFirstOrNull);
- if (row == null) return null;
-
- const { deployment_version: version, user } = row;
+ if (version == null) return null;
const resources = await db
.select()
@@ -157,7 +141,7 @@ export const getDeploymentStats = async (
status,
resourceCount,
duration,
- deployedBy: user?.name ?? null,
+ deployedBy: null,
successRate,
deployedAt: version.createdAt,
};
diff --git a/packages/api/src/router/environment-policy.ts b/packages/api/src/router/environment-policy.ts
deleted file mode 100644
index f45e49887..000000000
--- a/packages/api/src/router/environment-policy.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-import type { Tx } from "@ctrlplane/db";
-import _ from "lodash";
-import { isPresent } from "ts-is-present";
-import { z } from "zod";
-
-import { and, eq, sql, takeFirst } from "@ctrlplane/db";
-import {
- createEnvironmentPolicy,
- createEnvironmentPolicyDeployment,
- environment,
- environmentPolicy,
- environmentPolicyDeployment,
- environmentPolicyReleaseWindow,
- updateEnvironmentPolicy,
-} from "@ctrlplane/db/schema";
-import { Permission } from "@ctrlplane/validators/auth";
-
-import { createTRPCRouter, protectedProcedure } from "../trpc";
-import { approvalRouter } from "./environment-approval";
-
-const basePolicyQuery = (db: Tx) =>
- db
- .select()
- .from(environmentPolicy)
- .leftJoin(
- environmentPolicyReleaseWindow,
- eq(environmentPolicyReleaseWindow.policyId, environmentPolicy.id),
- );
-
-export const policyRouter = createTRPCRouter({
- approval: approvalRouter,
-
- deployment: createTRPCRouter({
- bySystemId: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemGet)
- .on({ type: "system", id: input }),
- })
- .input(z.string().uuid())
- .query(({ ctx, input }) =>
- ctx.db
- .select()
- .from(environmentPolicyDeployment)
- .innerJoin(
- environmentPolicy,
- eq(environmentPolicy.id, environmentPolicyDeployment.policyId),
- )
- .where(eq(environmentPolicy.systemId, input))
- .then((d) => d.map((d) => d.environment_policy_deployment)),
- ),
-
- create: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemUpdate)
- .on({ type: "environment", id: input.environmentId }),
- })
- .input(createEnvironmentPolicyDeployment)
- .mutation(({ ctx, input }) =>
- ctx.db
- .insert(environmentPolicyDeployment)
- .values([input])
- .returning()
- .then(takeFirst),
- ),
-
- delete: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemUpdate)
- .on({ type: "environment", id: input.environmentId }),
- })
- .input(
- z.object({
- policyId: z.string().uuid(),
- environmentId: z.string().uuid(),
- }),
- )
- .mutation(({ ctx, input }) =>
- ctx.db
- .delete(environmentPolicyDeployment)
- .where(
- and(
- eq(environmentPolicyDeployment.policyId, input.policyId),
- eq(
- environmentPolicyDeployment.environmentId,
- input.environmentId,
- ),
- ),
- )
- .returning()
- .then(takeFirst),
- ),
- }),
-
- bySystemId: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser.perform(Permission.SystemGet).on({ type: "system", id: input }),
- })
- .input(z.string().uuid())
- .query(({ ctx, input }) =>
- ctx.db
- .select()
- .from(environmentPolicy)
- .leftJoin(
- environmentPolicyReleaseWindow,
- eq(environmentPolicyReleaseWindow.policyId, environmentPolicy.id),
- )
- .where(eq(environmentPolicy.systemId, input))
- .then((policies) =>
- _.chain(policies)
- .groupBy("environment_policy.id")
- .map((p) => ({
- ...p[0]!.environment_policy,
- releaseWindows: p
- .map((t) => t.environment_policy_release_window)
- .filter(isPresent),
- }))
- .value(),
- ),
- ),
-
- byEnvironmentId: protectedProcedure
- .input(z.string().uuid())
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.EnvironmentGet)
- .on({ type: "environment", id: input }),
- })
- .query(({ ctx, input }) =>
- basePolicyQuery(ctx.db)
- .where(eq(environmentPolicy.environmentId, input))
- .then((rows) => {
- const policy = rows.at(0)!;
-
- const releaseWindows = _.chain(rows)
- .map((r) => r.environment_policy_release_window)
- .filter(isPresent)
- .uniqBy((r) => r.id)
- .map((r) => ({
- ...r,
- startTime: new Date(r.startTime),
- endTime: new Date(r.endTime),
- }))
- .value();
-
- return {
- ...policy.environment_policy,
- releaseWindows,
- };
- }),
- ),
-
- byId: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemGet)
- .on({ type: "environmentPolicy", id: input }),
- })
- .input(z.string().uuid())
- .query(async ({ ctx, input }) =>
- basePolicyQuery(ctx.db)
- .leftJoin(environment, eq(environment.policyId, environmentPolicy.id))
- .where(eq(environmentPolicy.id, input))
- .then((rows) => {
- const policy = rows.at(0)!;
-
- const releaseWindows = _.chain(rows)
- .map((r) => r.environment_policy_release_window)
- .filter(isPresent)
- .uniqBy((r) => r.id)
- .map((r) => ({
- ...r,
- startTime: new Date(r.startTime),
- endTime: new Date(r.endTime),
- }))
- .value();
-
- const environments = _.chain(rows)
- .map((r) => r.environment)
- .filter(isPresent)
- .uniqBy((e) => e.id)
- .value();
-
- return {
- ...policy.environment_policy,
- releaseWindows,
- environments,
- };
- }),
- ),
-
- create: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemUpdate)
- .on({ type: "system", id: input.systemId }),
- })
- .input(createEnvironmentPolicy)
- .mutation(async ({ ctx, input }) =>
- ctx.db.transaction(async (db) =>
- db.insert(environmentPolicy).values(input).returning().then(takeFirst),
- ),
- ),
-
- update: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemUpdate)
- .on({ type: "environmentPolicy", id: input.id }),
- })
- .input(z.object({ id: z.string().uuid(), data: updateEnvironmentPolicy }))
- .mutation(async ({ ctx, input }) => {
- return ctx.db
- .select()
- .from(environmentPolicy)
- .where(eq(environmentPolicy.id, input.id))
- .then(takeFirst);
- }),
-
- delete: protectedProcedure
- .meta({
- authorizationCheck: ({ canUser, input }) =>
- canUser
- .perform(Permission.SystemUpdate)
- .on({ type: "environmentPolicy", id: input }),
- })
- .input(z.string().uuid())
- .mutation(({ ctx, input }) =>
- ctx.db.transaction((db) =>
- db
- .execute(
- sql`UPDATE environment e
- SET policy_id = ep.id
- FROM environment_policy ep
- WHERE e.id = ep.environment_id
- AND e.policy_id = ${input}
- `,
- )
- .then(() =>
- db
- .delete(environmentPolicy)
- .where(eq(environmentPolicy.id, input))
- .returning()
- .then(takeFirst),
- ),
- ),
- ),
-});
diff --git a/packages/api/src/router/environment.ts b/packages/api/src/router/environment.ts
index 7ee673327..4f02e5ca3 100644
--- a/packages/api/src/router/environment.ts
+++ b/packages/api/src/router/environment.ts
@@ -8,8 +8,6 @@ import {
createEnvironment,
environment,
environmentMetadata,
- environmentPolicy,
- environmentPolicyReleaseWindow,
resource,
system,
updateEnvironment,
@@ -19,11 +17,9 @@ import { Permission } from "@ctrlplane/validators/auth";
import { createTRPCRouter, protectedProcedure } from "../trpc";
import { environmentPageRouter } from "./environment-page/router";
-import { policyRouter } from "./environment-policy";
import { environmentStatsRouter } from "./environment-stats";
export const environmentRouter = createTRPCRouter({
- policy: policyRouter,
stats: environmentStatsRouter,
page: environmentPageRouter,
@@ -39,14 +35,6 @@ export const environmentRouter = createTRPCRouter({
return ctx.db
.select()
.from(environment)
- .innerJoin(
- environmentPolicy,
- eq(environment.policyId, environmentPolicy.id),
- )
- .leftJoin(
- environmentPolicyReleaseWindow,
- eq(environmentPolicyReleaseWindow.policyId, environmentPolicy.id),
- )
.innerJoin(system, eq(environment.systemId, system.id))
.leftJoin(
environmentMetadata,
@@ -57,17 +45,6 @@ export const environmentRouter = createTRPCRouter({
const env = rows.at(0);
if (env == null) return null;
- const policy = {
- ...env.environment_policy,
- releaseWindows: _.chain(rows)
- .map((r) => r.environment_policy_release_window)
- .filter(isPresent)
- .uniqBy((r) => r.id)
- .value(),
- isDefaultPolicy:
- env.environment_policy.environmentId === env.environment.id,
- };
-
const metadata = _.chain(rows)
.map((r) => r.environment_metadata)
.filter(isPresent)
@@ -78,7 +55,6 @@ export const environmentRouter = createTRPCRouter({
return {
...env.environment,
- policy,
system: env.system,
metadata,
};
@@ -225,11 +201,9 @@ export const environmentRouter = createTRPCRouter({
.where(eq(environment.id, input.id))
.then(takeFirst);
- const policyId = oldEnv.environment.policyId;
-
const updatedEnv = await ctx.db
.update(environment)
- .set({ ...input.data, policyId })
+ .set({ ...input.data })
.where(eq(environment.id, input.id))
.returning()
.then(takeFirst);
diff --git a/packages/auth/src/utils/rbac.ts b/packages/auth/src/utils/rbac.ts
index 7ed2a82a3..d7585a7e1 100644
--- a/packages/auth/src/utils/rbac.ts
+++ b/packages/auth/src/utils/rbac.ts
@@ -16,7 +16,6 @@ import {
deploymentVersion,
entityRole,
environment,
- environmentPolicy,
job,
jobAgent,
policy,
@@ -130,22 +129,6 @@ const getEnvironmentScopes = async (id: string) => {
];
};
-const getEnvironmentPolicyScopes = async (id: string) => {
- const result = await db
- .select()
- .from(workspace)
- .innerJoin(system, eq(system.workspaceId, workspace.id))
- .innerJoin(environmentPolicy, eq(environmentPolicy.systemId, system.id))
- .where(eq(environmentPolicy.id, id))
- .then(takeFirst);
-
- return [
- { type: "environmentPolicy" as const, id: result.environment_policy.id },
- { type: "system" as const, id: result.system.id },
- { type: "workspace" as const, id: result.workspace.id },
- ];
-};
-
const getVariableSetScopes = async (id: string) => {
const result = await db
.select()
@@ -471,7 +454,6 @@ export const scopeHandlers: Record<
system: getSystemScopes,
workspace: getWorkspaceScopes,
environment: getEnvironmentScopes,
- environmentPolicy: getEnvironmentPolicyScopes,
deploymentVersion: getDeploymentVersionScopes,
resourceMetadataGroup: getResourceMetadataGroupScopes,
variableSet: getVariableSetScopes,
diff --git a/packages/db/drizzle/0121_tricky_eddie_brock.sql b/packages/db/drizzle/0121_tricky_eddie_brock.sql
new file mode 100644
index 000000000..85ab6f1da
--- /dev/null
+++ b/packages/db/drizzle/0121_tricky_eddie_brock.sql
@@ -0,0 +1,20 @@
+ALTER TABLE "environment_policy_deployment" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
+ALTER TABLE "environment_policy" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
+ALTER TABLE "environment_policy_approval" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
+ALTER TABLE "environment_policy_release_window" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint
+DROP TABLE "environment_policy_deployment" CASCADE;--> statement-breakpoint
+DROP TABLE "environment_policy" CASCADE;--> statement-breakpoint
+DROP TABLE "environment_policy_approval" CASCADE;--> statement-breakpoint
+DROP TABLE "environment_policy_release_window" CASCADE;--> statement-breakpoint
+ALTER TABLE "environment" DROP CONSTRAINT IF EXISTS "environment_policy_id_environment_policy_id_fk";
+--> statement-breakpoint
+ALTER TABLE "environment" DROP COLUMN "policy_id";--> statement-breakpoint
+ALTER TABLE "public"."entity_role" ALTER COLUMN "scope_type" SET DATA TYPE text;--> statement-breakpoint
+DROP TYPE "public"."scope_type";--> statement-breakpoint
+CREATE TYPE "public"."scope_type" AS ENUM('deploymentVersion', 'resource', 'resourceProvider', 'resourceMetadataGroup', 'resourceRelationshipRule', 'workspace', 'environment', 'deploymentVariable', 'deploymentVariableValue', 'variableSet', 'system', 'deployment', 'job', 'jobAgent', 'runbook', 'policy', 'resourceView', 'releaseTarget');--> statement-breakpoint
+ALTER TABLE "public"."entity_role" ALTER COLUMN "scope_type" SET DATA TYPE "public"."scope_type" USING "scope_type"::"public"."scope_type";--> statement-breakpoint
+DROP TYPE "public"."environment_policy_approval_requirement";--> statement-breakpoint
+DROP TYPE "public"."approval_status_type";--> statement-breakpoint
+DROP TYPE "public"."environment_policy_deployment_success_type";--> statement-breakpoint
+DROP TYPE "public"."recurrence_type";--> statement-breakpoint
+DROP TYPE "public"."release_sequencing_type";
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0121_snapshot.json b/packages/db/drizzle/meta/0121_snapshot.json
new file mode 100644
index 000000000..2dd304919
--- /dev/null
+++ b/packages/db/drizzle/meta/0121_snapshot.json
@@ -0,0 +1,6260 @@
+{
+ "id": "c93cea3d-03ad-41dc-b664-dda1dcdf6c52",
+ "prevId": "689c34cc-2fc8-4a86-84f4-451a3dbc68f6",
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": "cascade",
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": "cascade",
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {},
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_variable_value_direct": {
+ "name": "deployment_variable_value_direct",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_value_id": {
+ "name": "variable_value_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_hash": {
+ "name": "value_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "deployment_variable_value_direct_variable_value_id_deployment_variable_value_id_fk": {
+ "name": "deployment_variable_value_direct_variable_value_id_deployment_variable_value_id_fk",
+ "tableFrom": "deployment_variable_value_direct",
+ "tableTo": "deployment_variable_value",
+ "columnsFrom": ["variable_value_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "deployment_variable_value_direct_variable_value_id_unique": {
+ "name": "deployment_variable_value_direct_variable_value_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["variable_value_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.deployment_variable_value_reference": {
+ "name": "deployment_variable_value_reference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_value_id": {
+ "name": "variable_value_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference": {
+ "name": "reference",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "path": {
+ "name": "path",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_value": {
+ "name": "default_value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "deployment_variable_value_reference_variable_value_id_deployment_variable_value_id_fk": {
+ "name": "deployment_variable_value_reference_variable_value_id_deployment_variable_value_id_fk",
+ "tableFrom": "deployment_variable_value_reference",
+ "tableTo": "deployment_variable_value",
+ "columnsFrom": ["variable_value_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "deployment_variable_value_reference_variable_value_id_unique": {
+ "name": "deployment_variable_value_reference_variable_value_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["variable_value_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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 (3) with time zone",
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {}
+ },
+ "deployment_version_metadata_version_id_idx": {
+ "name": "deployment_version_metadata_version_id_idx",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.computed_deployment_resource": {
+ "name": "computed_deployment_resource",
+ "schema": "",
+ "columns": {
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "computed_deployment_resource_deployment_id_deployment_id_fk": {
+ "name": "computed_deployment_resource_deployment_id_deployment_id_fk",
+ "tableFrom": "computed_deployment_resource",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "computed_deployment_resource_resource_id_resource_id_fk": {
+ "name": "computed_deployment_resource_resource_id_resource_id_fk",
+ "tableFrom": "computed_deployment_resource",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "computed_deployment_resource_deployment_id_resource_id_pk": {
+ "name": "computed_deployment_resource_deployment_id_resource_id_pk",
+ "columns": ["deployment_id", "resource_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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_selector": {
+ "name": "resource_selector",
+ "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": "cascade",
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.computed_environment_resource": {
+ "name": "computed_environment_resource",
+ "schema": "",
+ "columns": {
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "computed_environment_resource_environment_id_environment_id_fk": {
+ "name": "computed_environment_resource_environment_id_environment_id_fk",
+ "tableFrom": "computed_environment_resource",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "computed_environment_resource_resource_id_resource_id_fk": {
+ "name": "computed_environment_resource_resource_id_resource_id_fk",
+ "tableFrom": "computed_environment_resource",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "computed_environment_resource_environment_id_resource_id_pk": {
+ "name": "computed_environment_resource_environment_id_resource_id_pk",
+ "columns": ["environment_id", "resource_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": "''"
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "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"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.event": {
+ "name": "event",
+ "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
+ },
+ "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": {
+ "event_workspace_id_workspace_id_fk": {
+ "name": "event_workspace_id_workspace_id_fk",
+ "tableFrom": "event",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {
+ "name_scope_type_scope_id_unique": {
+ "name": "name_scope_type_scope_id_unique",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.resource_provider_github_repo": {
+ "name": "resource_provider_github_repo",
+ "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
+ },
+ "github_entity_id": {
+ "name": "github_entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repo_id": {
+ "name": "repo_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "unique_resource_provider_github_entity_repo": {
+ "name": "unique_resource_provider_github_entity_repo",
+ "columns": [
+ {
+ "expression": "github_entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repo_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_provider_github_repo_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_github_repo_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_github_repo",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "resource_provider_github_repo_github_entity_id_github_entity_id_fk": {
+ "name": "resource_provider_github_repo_github_entity_id_github_entity_id_fk",
+ "tableFrom": "resource_provider_github_repo",
+ "tableTo": "github_entity",
+ "columnsFrom": ["github_entity_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": false
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "reference": {
+ "name": "reference",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_value": {
+ "name": "default_value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_type": {
+ "name": "value_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'direct'"
+ }
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {
+ "name_system_id_unique": {
+ "name": "name_system_id_unique",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "system_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": false
+ },
+ "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": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "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": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.computed_policy_target_release_target": {
+ "name": "computed_policy_target_release_target",
+ "schema": "",
+ "columns": {
+ "policy_target_id": {
+ "name": "policy_target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "release_target_id": {
+ "name": "release_target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "computed_policy_target_release_target_policy_target_id_policy_target_id_fk": {
+ "name": "computed_policy_target_release_target_policy_target_id_policy_target_id_fk",
+ "tableFrom": "computed_policy_target_release_target",
+ "tableTo": "policy_target",
+ "columnsFrom": ["policy_target_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "computed_policy_target_release_target_release_target_id_release_target_id_fk": {
+ "name": "computed_policy_target_release_target_release_target_id_release_target_id_fk",
+ "tableFrom": "computed_policy_target_release_target",
+ "tableTo": "release_target",
+ "columnsFrom": ["release_target_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "computed_policy_target_release_target_policy_target_id_release_target_id_pk": {
+ "name": "computed_policy_target_release_target_policy_target_id_release_target_id_pk",
+ "columns": ["policy_target_id", "release_target_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy": {
+ "name": "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
+ },
+ "priority": {
+ "name": "priority",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_workspace_id_workspace_id_fk": {
+ "name": "policy_workspace_id_workspace_id_fk",
+ "tableFrom": "policy",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "policy_workspace_id_name_unique": {
+ "name": "policy_workspace_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id", "name"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_target": {
+ "name": "policy_target",
+ "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
+ },
+ "deployment_selector": {
+ "name": "deployment_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "environment_selector": {
+ "name": "environment_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_target_policy_id_policy_id_fk": {
+ "name": "policy_target_policy_id_policy_id_fk",
+ "tableFrom": "policy_target",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.release": {
+ "name": "release",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version_release_id": {
+ "name": "version_release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variable_release_id": {
+ "name": "variable_release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "release_version_release_id_version_release_id_fk": {
+ "name": "release_version_release_id_version_release_id_fk",
+ "tableFrom": "release",
+ "tableTo": "version_release",
+ "columnsFrom": ["version_release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_variable_release_id_variable_set_release_id_fk": {
+ "name": "release_variable_release_id_variable_set_release_id_fk",
+ "tableFrom": "release",
+ "tableTo": "variable_set_release",
+ "columnsFrom": ["variable_release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.release_job": {
+ "name": "release_job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "release_id": {
+ "name": "release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "release_job_release_id_release_id_fk": {
+ "name": "release_job_release_id_release_id_fk",
+ "tableFrom": "release_job",
+ "tableTo": "release",
+ "columnsFrom": ["release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_job_job_id_job_id_fk": {
+ "name": "release_job_job_id_job_id_fk",
+ "tableFrom": "release_job",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.release_target": {
+ "name": "release_target",
+ "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
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "desired_release_id": {
+ "name": "desired_release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "desired_version_id": {
+ "name": "desired_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "release_target_resource_id_environment_id_deployment_id_index": {
+ "name": "release_target_resource_id_environment_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "release_target_resource_id_resource_id_fk": {
+ "name": "release_target_resource_id_resource_id_fk",
+ "tableFrom": "release_target",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_target_environment_id_environment_id_fk": {
+ "name": "release_target_environment_id_environment_id_fk",
+ "tableFrom": "release_target",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_target_deployment_id_deployment_id_fk": {
+ "name": "release_target_deployment_id_deployment_id_fk",
+ "tableFrom": "release_target",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_target_desired_release_id_release_id_fk": {
+ "name": "release_target_desired_release_id_release_id_fk",
+ "tableFrom": "release_target",
+ "tableTo": "release",
+ "columnsFrom": ["desired_release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "release_target_desired_version_id_deployment_version_id_fk": {
+ "name": "release_target_desired_version_id_deployment_version_id_fk",
+ "tableFrom": "release_target",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["desired_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.release_target_lock_record": {
+ "name": "release_target_lock_record",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "release_target_id": {
+ "name": "release_target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "unlocked_at": {
+ "name": "unlocked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked_by": {
+ "name": "locked_by",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "release_target_lock_record_release_target_id_index": {
+ "name": "release_target_lock_record_release_target_id_index",
+ "columns": [
+ {
+ "expression": "release_target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"release_target_lock_record\".\"unlocked_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "release_target_lock_record_release_target_id_release_target_id_fk": {
+ "name": "release_target_lock_record_release_target_id_release_target_id_fk",
+ "tableFrom": "release_target_lock_record",
+ "tableTo": "release_target",
+ "columnsFrom": ["release_target_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_target_lock_record_locked_by_user_id_fk": {
+ "name": "release_target_lock_record_locked_by_user_id_fk",
+ "tableFrom": "release_target_lock_record",
+ "tableTo": "user",
+ "columnsFrom": ["locked_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.variable_set_release": {
+ "name": "variable_set_release",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "release_target_id": {
+ "name": "release_target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "variable_set_release_release_target_id_release_target_id_fk": {
+ "name": "variable_set_release_release_target_id_release_target_id_fk",
+ "tableFrom": "variable_set_release",
+ "tableTo": "release_target",
+ "columnsFrom": ["release_target_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.variable_set_release_value": {
+ "name": "variable_set_release_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_set_release_id": {
+ "name": "variable_set_release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variable_value_snapshot_id": {
+ "name": "variable_value_snapshot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "variable_set_release_value_variable_set_release_id_variable_value_snapshot_id_index": {
+ "name": "variable_set_release_value_variable_set_release_id_variable_value_snapshot_id_index",
+ "columns": [
+ {
+ "expression": "variable_set_release_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "variable_value_snapshot_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "variable_set_release_value_variable_set_release_id_variable_set_release_id_fk": {
+ "name": "variable_set_release_value_variable_set_release_id_variable_set_release_id_fk",
+ "tableFrom": "variable_set_release_value",
+ "tableTo": "variable_set_release",
+ "columnsFrom": ["variable_set_release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "variable_set_release_value_variable_value_snapshot_id_variable_value_snapshot_id_fk": {
+ "name": "variable_set_release_value_variable_value_snapshot_id_variable_value_snapshot_id_fk",
+ "tableFrom": "variable_set_release_value",
+ "tableTo": "variable_value_snapshot",
+ "columnsFrom": ["variable_value_snapshot_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.variable_value_snapshot": {
+ "name": "variable_value_snapshot",
+ "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
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "variable_value_snapshot_workspace_id_key_value_index": {
+ "name": "variable_value_snapshot_workspace_id_key_value_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "value",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "variable_value_snapshot_workspace_id_key_index": {
+ "name": "variable_value_snapshot_workspace_id_key_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"variable_value_snapshot\".\"value\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "variable_value_snapshot_workspace_id_workspace_id_fk": {
+ "name": "variable_value_snapshot_workspace_id_workspace_id_fk",
+ "tableFrom": "variable_value_snapshot",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.version_release": {
+ "name": "version_release",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "release_target_id": {
+ "name": "release_target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_id": {
+ "name": "version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "version_release_release_target_id_release_target_id_fk": {
+ "name": "version_release_release_target_id_release_target_id_fk",
+ "tableFrom": "version_release",
+ "tableTo": "release_target",
+ "columnsFrom": ["release_target_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "version_release_version_id_deployment_version_id_fk": {
+ "name": "version_release_version_id_deployment_version_id_fk",
+ "tableFrom": "version_release",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_deny_window": {
+ "name": "policy_rule_deny_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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "rrule": {
+ "name": "rrule",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "dtend": {
+ "name": "dtend",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "time_zone": {
+ "name": "time_zone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_deny_window_policy_id_policy_id_fk": {
+ "name": "policy_rule_deny_window_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_deny_window",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_user_approval": {
+ "name": "policy_rule_user_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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_user_approval_policy_id_policy_id_fk": {
+ "name": "policy_rule_user_approval_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_user_approval",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_user_approval_user_id_user_id_fk": {
+ "name": "policy_rule_user_approval_user_id_user_id_fk",
+ "tableFrom": "policy_rule_user_approval",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_user_approval_record": {
+ "name": "policy_rule_user_approval_record",
+ "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
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "approval_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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
+ },
+ "rule_id": {
+ "name": "rule_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_user_approval_record_deployment_version_id_deployment_version_id_fk": {
+ "name": "policy_rule_user_approval_record_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "policy_rule_user_approval_record",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_user_approval_record_environment_id_environment_id_fk": {
+ "name": "policy_rule_user_approval_record_environment_id_environment_id_fk",
+ "tableFrom": "policy_rule_user_approval_record",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_user_approval_record_user_id_user_id_fk": {
+ "name": "policy_rule_user_approval_record_user_id_user_id_fk",
+ "tableFrom": "policy_rule_user_approval_record",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "policy_rule_user_approval_record_rule_id_policy_rule_user_approval_id_fk": {
+ "name": "policy_rule_user_approval_record_rule_id_policy_rule_user_approval_id_fk",
+ "tableFrom": "policy_rule_user_approval_record",
+ "tableTo": "policy_rule_user_approval",
+ "columnsFrom": ["rule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_role_approval": {
+ "name": "policy_rule_role_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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "required_approvals_count": {
+ "name": "required_approvals_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_role_approval_policy_id_policy_id_fk": {
+ "name": "policy_rule_role_approval_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_role_approval",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_role_approval_role_id_role_id_fk": {
+ "name": "policy_rule_role_approval_role_id_role_id_fk",
+ "tableFrom": "policy_rule_role_approval",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_role_approval_record": {
+ "name": "policy_rule_role_approval_record",
+ "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
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "approval_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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
+ },
+ "rule_id": {
+ "name": "rule_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_role_approval_record_deployment_version_id_deployment_version_id_fk": {
+ "name": "policy_rule_role_approval_record_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "policy_rule_role_approval_record",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_role_approval_record_environment_id_environment_id_fk": {
+ "name": "policy_rule_role_approval_record_environment_id_environment_id_fk",
+ "tableFrom": "policy_rule_role_approval_record",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_role_approval_record_user_id_user_id_fk": {
+ "name": "policy_rule_role_approval_record_user_id_user_id_fk",
+ "tableFrom": "policy_rule_role_approval_record",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "policy_rule_role_approval_record_rule_id_policy_rule_role_approval_id_fk": {
+ "name": "policy_rule_role_approval_record_rule_id_policy_rule_role_approval_id_fk",
+ "tableFrom": "policy_rule_role_approval_record",
+ "tableTo": "policy_rule_role_approval",
+ "columnsFrom": ["rule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_any_approval": {
+ "name": "policy_rule_any_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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "required_approvals_count": {
+ "name": "required_approvals_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ }
+ },
+ "indexes": {
+ "unique_policy_id": {
+ "name": "unique_policy_id",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "policy_rule_any_approval_policy_id_policy_id_fk": {
+ "name": "policy_rule_any_approval_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_any_approval",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_any_approval_record": {
+ "name": "policy_rule_any_approval_record",
+ "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
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "approval_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": {
+ "unique_deployment_version_id_environment_id_user_id": {
+ "name": "unique_deployment_version_id_environment_id_user_id",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "policy_rule_any_approval_record_deployment_version_id_deployment_version_id_fk": {
+ "name": "policy_rule_any_approval_record_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "policy_rule_any_approval_record",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_any_approval_record_environment_id_environment_id_fk": {
+ "name": "policy_rule_any_approval_record_environment_id_environment_id_fk",
+ "tableFrom": "policy_rule_any_approval_record",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "policy_rule_any_approval_record_user_id_user_id_fk": {
+ "name": "policy_rule_any_approval_record_user_id_user_id_fk",
+ "tableFrom": "policy_rule_any_approval_record",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_deployment_version_selector": {
+ "name": "policy_rule_deployment_version_selector",
+ "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
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_version_selector": {
+ "name": "deployment_version_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_deployment_version_selector_policy_id_policy_id_fk": {
+ "name": "policy_rule_deployment_version_selector_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_deployment_version_selector",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "policy_rule_deployment_version_selector_policy_id_unique": {
+ "name": "policy_rule_deployment_version_selector_policy_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["policy_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_concurrency": {
+ "name": "policy_rule_concurrency",
+ "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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "concurrency": {
+ "name": "concurrency",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_concurrency_policy_id_policy_id_fk": {
+ "name": "policy_rule_concurrency_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_concurrency",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "policy_rule_concurrency_policy_id_unique": {
+ "name": "policy_rule_concurrency_policy_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["policy_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_environment_version_rollout": {
+ "name": "policy_rule_environment_version_rollout",
+ "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
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "position_growth_factor": {
+ "name": "position_growth_factor",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "time_scale_interval": {
+ "name": "time_scale_interval",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rollout_type": {
+ "name": "rollout_type",
+ "type": "rollout_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'linear'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_environment_version_rollout_policy_id_policy_id_fk": {
+ "name": "policy_rule_environment_version_rollout_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_environment_version_rollout",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "policy_rule_environment_version_rollout_policy_id_unique": {
+ "name": "policy_rule_environment_version_rollout_policy_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["policy_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.policy_rule_retry": {
+ "name": "policy_rule_retry",
+ "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
+ },
+ "max_retries": {
+ "name": "max_retries",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "policy_rule_retry_policy_id_policy_id_fk": {
+ "name": "policy_rule_retry_policy_id_policy_id_fk",
+ "tableFrom": "policy_rule_retry",
+ "tableTo": "policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "policy_rule_retry_policy_id_unique": {
+ "name": "policy_rule_retry_policy_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["policy_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.resource_relationship_rule": {
+ "name": "resource_relationship_rule",
+ "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": false
+ },
+ "reference": {
+ "name": "reference",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dependency_type": {
+ "name": "dependency_type",
+ "type": "resource_dependency_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dependency_description": {
+ "name": "dependency_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_version": {
+ "name": "source_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_kind": {
+ "name": "target_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_version": {
+ "name": "target_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "unique_resource_relationship_rule_reference": {
+ "name": "unique_resource_relationship_rule_reference",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "reference",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_relationship_rule_workspace_id_workspace_id_fk": {
+ "name": "resource_relationship_rule_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_relationship_rule",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.resource_relationship_rule_metadata_match": {
+ "name": "resource_relationship_rule_metadata_match",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_relationship_rule_id": {
+ "name": "resource_relationship_rule_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "unique_resource_relationship_rule_metadata_match": {
+ "name": "unique_resource_relationship_rule_metadata_match",
+ "columns": [
+ {
+ "expression": "resource_relationship_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_relationship_rule_metadata_match_resource_relationship_rule_id_resource_relationship_rule_id_fk": {
+ "name": "resource_relationship_rule_metadata_match_resource_relationship_rule_id_resource_relationship_rule_id_fk",
+ "tableFrom": "resource_relationship_rule_metadata_match",
+ "tableTo": "resource_relationship_rule",
+ "columnsFrom": ["resource_relationship_rule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.resource_relationship_rule_target_metadata_equals": {
+ "name": "resource_relationship_rule_target_metadata_equals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_relationship_rule_id": {
+ "name": "resource_relationship_rule_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": {
+ "unique_resource_relationship_rule_target_metadata_equals": {
+ "name": "unique_resource_relationship_rule_target_metadata_equals",
+ "columns": [
+ {
+ "expression": "resource_relationship_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_relationship_rule_target_metadata_equals_resource_relationship_rule_id_resource_relationship_rule_id_fk": {
+ "name": "resource_relationship_rule_target_metadata_equals_resource_relationship_rule_id_resource_relationship_rule_id_fk",
+ "tableFrom": "resource_relationship_rule_target_metadata_equals",
+ "tableTo": "resource_relationship_rule",
+ "columnsFrom": ["resource_relationship_rule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.system_role": {
+ "name": "system_role",
+ "schema": "public",
+ "values": ["user", "admin"]
+ },
+ "public.deployment_version_status": {
+ "name": "deployment_version_status",
+ "schema": "public",
+ "values": ["building", "ready", "failed", "rejected"]
+ },
+ "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.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": [
+ "deploymentVersion",
+ "resource",
+ "resourceProvider",
+ "resourceMetadataGroup",
+ "resourceRelationshipRule",
+ "workspace",
+ "environment",
+ "deploymentVariable",
+ "deploymentVariableValue",
+ "variableSet",
+ "system",
+ "deployment",
+ "job",
+ "jobAgent",
+ "runbook",
+ "policy",
+ "resourceView",
+ "releaseTarget"
+ ]
+ },
+ "public.approval_status": {
+ "name": "approval_status",
+ "schema": "public",
+ "values": ["approved", "rejected"]
+ },
+ "public.rollout_type": {
+ "name": "rollout_type",
+ "schema": "public",
+ "values": [
+ "linear",
+ "linear_normalized",
+ "exponential",
+ "exponential_normalized"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 70fcaf21d..68ead5ad6 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -848,6 +848,13 @@
"when": 1751335343118,
"tag": "0120_eminent_frank_castle",
"breakpoints": true
+ },
+ {
+ "idx": 121,
+ "version": "7",
+ "when": 1751337272586,
+ "tag": "0121_tricky_eddie_brock",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/src/schema/environment-policy-deployment.ts b/packages/db/src/schema/environment-policy-deployment.ts
deleted file mode 100644
index 9a8d8eeff..000000000
--- a/packages/db/src/schema/environment-policy-deployment.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { InferSelectModel } from "drizzle-orm";
-import { pgTable, uniqueIndex, uuid } from "drizzle-orm/pg-core";
-import { createInsertSchema } from "drizzle-zod";
-
-import { environment, environmentPolicy } from "./environment.js";
-
-export const environmentPolicyDeployment = pgTable(
- "environment_policy_deployment",
- {
- id: uuid("id").primaryKey().defaultRandom(),
- policyId: uuid("policy_id")
- .notNull()
- .references(() => environmentPolicy.id, { onDelete: "cascade" }),
- environmentId: uuid("environment_id")
- .notNull()
- .references(() => environment.id, { onDelete: "cascade" }),
- },
- (t) => ({ uniq: uniqueIndex().on(t.policyId, t.environmentId) }),
-);
-
-export type EnvironmentPolicyDeployment = InferSelectModel<
- typeof environmentPolicyDeployment
->;
-
-export const createEnvironmentPolicyDeployment = createInsertSchema(
- environmentPolicyDeployment,
-).omit({ id: true });
diff --git a/packages/db/src/schema/environment-policy-relations.ts b/packages/db/src/schema/environment-policy-relations.ts
deleted file mode 100644
index c6ed7eedb..000000000
--- a/packages/db/src/schema/environment-policy-relations.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { relations } from "drizzle-orm";
-
-import { environment, environmentPolicy } from "./environment.js";
-
-export const environmentPolicyRelations = relations(
- environmentPolicy,
- ({ many }) => ({
- environments: many(environment),
- }),
-);
diff --git a/packages/db/src/schema/environment-relations.ts b/packages/db/src/schema/environment-relations.ts
index 5552a9c11..dcbfda654 100644
--- a/packages/db/src/schema/environment-relations.ts
+++ b/packages/db/src/schema/environment-relations.ts
@@ -4,7 +4,6 @@ import {
computedEnvironmentResource,
environment,
environmentMetadata,
- environmentPolicy,
} from "./environment.js";
import { releaseTarget } from "./release.js";
import { resource } from "./resource.js";
@@ -12,10 +11,6 @@ import { system } from "./system.js";
import { variableSetEnvironment } from "./variable-sets.js";
export const environmentRelations = relations(environment, ({ many, one }) => ({
- policy: one(environmentPolicy, {
- fields: [environment.policyId],
- references: [environmentPolicy.id],
- }),
environments: many(variableSetEnvironment),
system: one(system, {
fields: [environment.systemId],
diff --git a/packages/db/src/schema/environment.ts b/packages/db/src/schema/environment.ts
index 3eef44b72..2e6bc35d6 100644
--- a/packages/db/src/schema/environment.ts
+++ b/packages/db/src/schema/environment.ts
@@ -1,13 +1,8 @@
import type { ResourceCondition } from "@ctrlplane/validators/resources";
import type { InferSelectModel } from "drizzle-orm";
-import type { AnyPgColumn, ColumnsWithTable } from "drizzle-orm/pg-core";
import { sql } from "drizzle-orm";
import {
- bigint,
- foreignKey,
- integer,
jsonb,
- pgEnum,
pgTable,
primaryKey,
text,
@@ -23,8 +18,6 @@ import {
resourceCondition,
} from "@ctrlplane/validators/resources";
-import { user } from "./auth.js";
-import { deploymentVersion } from "./deployment-version.js";
import { resource } from "./resource.js";
import { system } from "./system.js";
@@ -58,7 +51,6 @@ export const environment = pgTable(
name: text("name").notNull(),
directory: text("directory").notNull().default(""),
description: text("description").default(""),
- policyId: uuid("policy_id").notNull(),
resourceSelector: jsonb("resource_selector")
.$type()
.default(sql`NULL`),
@@ -68,10 +60,6 @@ export const environment = pgTable(
},
(t) => ({
uniq: uniqueIndex().on(t.systemId, t.name),
- policyIdFk: foreignKey({
- columns: [t.policyId],
- foreignColumns: [environmentPolicy.id],
- }).onDelete("set null"),
}),
);
@@ -84,19 +72,12 @@ export const createEnvironment = createInsertSchema(environment, {
(selector) => selector == null || isValidResourceCondition(selector),
),
})
- .omit({ id: true, policyId: true })
- .extend({
- metadata: z.record(z.string()).optional(),
- policyId: z.string().uuid().optional(),
- });
+ .omit({ id: true })
+ .extend({ metadata: z.record(z.string()).optional() });
export const updateEnvironment = createEnvironment
.partial()
- .omit({ policyId: true })
- .extend({
- policyId: z.string().uuid().nullable().optional(),
- directory: directoryPath.optional(),
- });
+ .extend({ directory: directoryPath.optional() });
export type InsertEnvironment = z.infer;
export const environmentMetadata = pgTable(
@@ -124,157 +105,3 @@ export const computedEnvironmentResource = pgTable(
},
(t) => ({ pk: primaryKey({ columns: [t.environmentId, t.resourceId] }) }),
);
-
-export const approvalRequirement = pgEnum(
- "environment_policy_approval_requirement",
- ["manual", "automatic"],
-);
-
-export const environmentPolicyDeploymentSuccessType = pgEnum(
- "environment_policy_deployment_success_type",
- ["all", "some", "optional"],
-);
-
-export const releaseSequencingType = pgEnum("release_sequencing_type", [
- "wait",
- "cancel",
-]);
-
-export const environmentPolicy = pgTable(
- "environment_policy",
- {
- id: uuid("id").primaryKey().defaultRandom(),
- name: text("name").notNull(),
- description: text("description"),
-
- systemId: uuid("system_id")
- .notNull()
- .references(() => system.id, { onDelete: "cascade" }),
- environmentId: uuid("environment_id").references(
- (): any => environment.id,
- { onDelete: "cascade" },
- ),
- approvalRequirement: approvalRequirement("approval_required")
- .notNull()
- .default("automatic"),
-
- successType: environmentPolicyDeploymentSuccessType("success_status")
- .notNull()
- .default("all"),
- successMinimum: integer("minimum_success").notNull().default(0),
- concurrencyLimit: integer("concurrency_limit").default(sql`NULL`),
-
- // Duration in milliseconds over which to gradually roll out releases to this
- // environment
- rolloutDuration: bigint("rollout_duration", { mode: "number" })
- .notNull()
- .default(0),
-
- // Minimum interval between releases in milliseconds
- minimumReleaseInterval: bigint("minimum_release_interval", {
- mode: "number",
- })
- .notNull()
- .default(0),
-
- releaseSequencing: releaseSequencingType("release_sequencing")
- .notNull()
- .default("cancel"),
- },
- () => ({
- overridePolicyFK: foreignKey(overridePolicyFKConstraint).onDelete(
- "cascade",
- ),
- }),
-);
-
-export type EnvironmentPolicy = InferSelectModel;
-
-const overridePolicyFKConstraint: {
- columns: [AnyPgColumn<{ tableName: "environment_policy" }>];
- foreignColumns: ColumnsWithTable<
- "environment_policy",
- "environment",
- [AnyPgColumn<{ tableName: "environment_policy" }>]
- >;
-} = {
- columns: [environmentPolicy.environmentId],
- foreignColumns: [environment.id],
-};
-
-export const createEnvironmentPolicy = createInsertSchema(environmentPolicy)
- .omit({ id: true })
- .extend({
- releaseWindows: z
- .array(
- z.object({
- recurrence: z.enum(["hourly", "daily", "weekly", "monthly"]),
- startTime: z.date(),
- endTime: z.date(),
- }),
- )
- .optional(),
- });
-export type CreateEnvironmentPolicy = z.infer;
-export const updateEnvironmentPolicy = createEnvironmentPolicy.partial();
-export type UpdateEnvironmentPolicy = z.infer;
-
-export const recurrenceType = pgEnum("recurrence_type", [
- "hourly",
- "daily",
- "weekly",
- "monthly",
-]);
-
-export const environmentPolicyReleaseWindow = pgTable(
- "environment_policy_release_window",
- {
- id: uuid("id").primaryKey().defaultRandom(),
- policyId: uuid("policy_id")
- .notNull()
- .references(() => environmentPolicy.id, { onDelete: "cascade" }),
- startTime: timestamp("start_time", {
- withTimezone: true,
- precision: 0,
- }).notNull(),
- endTime: timestamp("end_time", {
- withTimezone: true,
- precision: 0,
- }).notNull(),
- recurrence: recurrenceType("recurrence").notNull(),
- },
-);
-
-export type EnvironmentPolicyReleaseWindow = InferSelectModel<
- typeof environmentPolicyReleaseWindow
->;
-
-export const approvalStatusType = pgEnum("approval_status_type", [
- "pending",
- "approved",
- "rejected",
-]);
-
-export const environmentPolicyApproval = pgTable(
- "environment_policy_approval",
- {
- id: uuid("id").primaryKey().defaultRandom(),
- policyId: uuid("policy_id")
- .notNull()
- .references(() => environmentPolicy.id, { onDelete: "cascade" }),
- deploymentVersionId: uuid("release_id")
- .notNull()
- .references(() => deploymentVersion.id, { onDelete: "cascade" }),
- status: approvalStatusType("status").notNull().default("pending"),
- userId: uuid("user_id").references(() => user.id, { onDelete: "set null" }),
- approvedAt: timestamp("approved_at", {
- withTimezone: true,
- precision: 0,
- }).default(sql`NULL`),
- },
- (t) => ({ uniq: uniqueIndex().on(t.policyId, t.deploymentVersionId) }),
-);
-
-export type EnvironmentPolicyApproval = InferSelectModel<
- typeof environmentPolicyApproval
->;
diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts
index 8ca4ccbbe..dbea1b48a 100644
--- a/packages/db/src/schema/index.ts
+++ b/packages/db/src/schema/index.ts
@@ -3,7 +3,6 @@ export * from "./resource.js";
export * from "./resource-provider.js";
export * from "./deployment.js";
export * from "./environment.js";
-export * from "./environment-policy-deployment.js";
export * from "./deployment-version.js";
export * from "./system.js";
export * from "./runbook.js";
@@ -25,6 +24,5 @@ export * from "./release.js";
export * from "./rules/index.js";
export * from "./environment-relations.js";
-export * from "./environment-policy-relations.js";
export * from "./policy-relations.js";
export * from "./resource-relationship-rule.js";
diff --git a/packages/db/src/schema/rbac.ts b/packages/db/src/schema/rbac.ts
index 79193f430..3dc3fb614 100644
--- a/packages/db/src/schema/rbac.ts
+++ b/packages/db/src/schema/rbac.ts
@@ -40,7 +40,6 @@ export const scopeType = pgEnum("scope_type", [
"resourceRelationshipRule",
"workspace",
"environment",
- "environmentPolicy",
"deploymentVariable",
"deploymentVariableValue",
"variableSet",
diff --git a/packages/db/src/utils/upsert-env.ts b/packages/db/src/utils/upsert-env.ts
index fff5a486b..93990e530 100644
--- a/packages/db/src/utils/upsert-env.ts
+++ b/packages/db/src/utils/upsert-env.ts
@@ -1,33 +1,24 @@
import type { z } from "zod";
-import { eq } from "drizzle-orm";
import type { Tx } from "../common.js";
import { buildConflictUpdateColumns, takeFirst } from "../common.js";
import * as SCHEMA from "../schema/index.js";
-import { environment, environmentPolicy } from "../schema/index.js";
+import { environment } from "../schema/index.js";
export const upsertEnv = async (
db: Tx,
input: z.infer,
) => {
const { metadata } = input;
- const overridePolicyId = await db
- .insert(environmentPolicy)
- .values({ name: input.name, systemId: input.systemId })
- .returning()
- .then(takeFirst)
- .then((policy) => policy.id);
- const policyId = input.policyId ?? overridePolicyId;
const env = await db
.insert(environment)
- .values({ ...input, policyId })
+ .values({ ...input })
.onConflictDoUpdate({
target: [environment.name, environment.systemId],
set: buildConflictUpdateColumns(environment, [
"description",
"directory",
- "policyId",
"resourceSelector",
]),
})
@@ -43,10 +34,5 @@ export const upsertEnv = async (
})),
);
- await db
- .update(environmentPolicy)
- .set({ environmentId: env.id })
- .where(eq(environmentPolicy.id, policyId));
-
return env;
};