From bf5fcf75d0ff50e4d628143076066b122436e861 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 5 Sep 2024 20:10:57 -0700 Subject: [PATCH 01/21] init --- .../github/GithubAddOrgDialog.tsx | 183 +++++++++++ .../github/GithubConnectedOrgs.tsx | 161 +++++++++ .../(integration)/github/GithubOrgConfig.tsx | 307 ------------------ .../(integration)/github/page.tsx | 128 +++++--- .../src/app/api/github/installation/route.ts | 162 +++++++++ .../src/router/github/create-github-org.ts | 216 ++++++++++++ packages/api/src/router/github/github.ts | 273 ++++++++++++++++ packages/db/src/schema/github.ts | 5 +- 8 files changed, 1078 insertions(+), 357 deletions(-) create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx delete mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubOrgConfig.tsx create mode 100644 apps/webservice/src/app/api/github/installation/route.ts create mode 100644 packages/api/src/router/github/create-github-org.ts create mode 100644 packages/api/src/router/github/github.ts diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx new file mode 100644 index 00000000..d4301a03 --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx @@ -0,0 +1,183 @@ +import { useState } from "react"; +import Link from "next/link"; +import { TbBulb } from "react-icons/tb"; + +import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; +import { Button } from "@ctrlplane/ui/button"; +import { + Command, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@ctrlplane/ui/command"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@ctrlplane/ui/dialog"; +import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover"; +import { Separator } from "@ctrlplane/ui/separator"; + +import { api } from "~/trpc/react"; + +interface GithubAddOrgDialogProps { + githubUserId: number; + children: React.ReactNode; + githubConfig: { + url: string; + botName: string; + clientId: string; + }; + workspaceId: string; + workspaceSlug: string; +} + +export const GithubAddOrgDialog: React.FC = ({ + githubUserId, + children, + githubConfig, + workspaceId, +}) => { + const [open, setOpen] = useState(false); + const [popoverOpen, setPopoverOpen] = useState(false); + const githubOrgs = + api.github.organizations.byGithubUserId.useQuery(githubUserId); + + const githubOrgsInstalled = + api.github.organizations.list.useQuery(workspaceId); + + const validOrgsToAdd = + githubOrgs.data?.filter( + (org) => + !githubOrgsInstalled.data?.some( + (o) => + o.github_organization.organizationName === org.login && + o.github_organization.connected === true, + ), + ) ?? []; + + const [image, setImage] = useState(null); + const [value, setValue] = useState(null); + + return ( + + {children} + +
+ + Connect a new Organization + + Install the Github app on the organization to connect it to your + workspace. + + + + + + +
+ + {validOrgsToAdd.length > 0 && ( + <> + +
+ + + Select from pre-connected organizations + + +
+ + + These organizations already have the Github application + installed, so you can simply add them to your workspace to + unlock agent configuration and config file syncing. Read + more{" "} + + here + + . + +
+
+
+ + + + + + + + + + + {validOrgsToAdd.map(({ id, login, avatar_url }) => ( + { + setValue(currentValue); + setImage(avatar_url); + setPopoverOpen(false); + }} + className="w-full cursor-pointer" + > +
+ + + + {login.slice(0, 2)} + + + {login} +
+
+ ))} +
+
+
+
+
+
+ + )} + + + + +
+
+ ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx new file mode 100644 index 00000000..405a34d4 --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx @@ -0,0 +1,161 @@ +import type { GithubUser } from "@ctrlplane/db/schema"; +import Link from "next/link"; +import _ from "lodash"; +import { SiGithub } from "react-icons/si"; +import { TbChevronDown, TbPlus } from "react-icons/tb"; + +import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; +import { Button } from "@ctrlplane/ui/button"; +import { + Card, + CardDescription, + CardHeader, + CardTitle, +} from "@ctrlplane/ui/card"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@ctrlplane/ui/dropdown-menu"; +import { Separator } from "@ctrlplane/ui/separator"; +import { Skeleton } from "@ctrlplane/ui/skeleton"; + +import { api } from "~/trpc/react"; +import { GithubAddOrgDialog } from "./GithubAddOrgDialog"; + +interface GithubConnectedOrgsProps { + githubUser?: GithubUser | null; + workspaceSlug?: string; + workspaceId?: string; + loading: boolean; + githubConfig: { + url: string; + botName: string; + clientId: string; + }; +} + +export const GithubConnectedOrgs: React.FC = ({ + githubUser, + workspaceSlug, + workspaceId, + githubConfig, +}) => { + const githubOrgsInstalled = api.github.organizations.list.useQuery( + workspaceId ?? "", + { enabled: workspaceId != null }, + ); + const githubOrgUpdate = api.github.organizations.update.useMutation(); + + return ( + + +
+ + Connected Github organizations + + + You can configure job agents and sync config files for these + organizations + +
+ + + +
+ + {githubOrgsInstalled.isLoading && ( +
+ {_.range(3).map((i) => ( + + ))} +
+ )} + {githubOrgsInstalled.data != null && + githubOrgsInstalled.data.length > 0 && ( + <> + +
+ {githubOrgsInstalled.data.map( + ({ github_organization, github_user }) => ( +
+
+ + + + + + +
+

+ {github_organization.organizationName} +

+ {github_user != null && ( +

+ Enabled by {github_user.githubUsername} on{" "} + {github_organization.createdAt.toLocaleDateString()} +

+ )} +
+
+ + + + + + + + Configure + + + { + githubOrgUpdate.mutateAsync({ + id: github_organization.id, + data: { + connected: false, + }, + }); + }} + > + Disconnect + + + +
+ ), + )} +
+ + )} +
+ ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubOrgConfig.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubOrgConfig.tsx deleted file mode 100644 index 710ace02..00000000 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubOrgConfig.tsx +++ /dev/null @@ -1,307 +0,0 @@ -import type { GithubUser } from "@ctrlplane/db/schema"; -import { useState } from "react"; -import _ from "lodash"; -import { SiGithub } from "react-icons/si"; -import { TbChevronDown, TbPlus } from "react-icons/tb"; - -import { cn } from "@ctrlplane/ui"; -import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; -import { Button } from "@ctrlplane/ui/button"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@ctrlplane/ui/card"; -import { - Command, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from "@ctrlplane/ui/command"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@ctrlplane/ui/dropdown-menu"; -import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover"; -import { Separator } from "@ctrlplane/ui/separator"; -import { Skeleton } from "@ctrlplane/ui/skeleton"; - -import { api } from "~/trpc/react"; - -interface GithubOrgConfigProps { - githubUser?: GithubUser | null; - workspaceSlug?: string; - workspaceId?: string; - loading: boolean; - githubConfig: { - url: string; - botName: string; - clientId: string; - }; -} - -export const GithubOrgConfig: React.FC = ({ - githubUser, - workspaceSlug, - workspaceId, - loading, - githubConfig, -}) => { - const githubOrgs = api.github.organizations.byGithubUserId.useQuery( - githubUser?.githubUserId ?? 0, - { enabled: !loading && githubUser != null }, - ); - const githubOrgCreate = api.github.organizations.create.useMutation(); - const githubOrgsInstalled = api.github.organizations.list.useQuery( - workspaceId ?? "", - { enabled: !loading && workspaceId != null }, - ); - const githubOrgUpdate = api.github.organizations.update.useMutation(); - const jobAgentCreate = api.job.agent.create.useMutation(); - - const utils = api.useUtils(); - - const [open, setOpen] = useState(false); - const [value, setValue] = useState(null); - const [image, setImage] = useState(null); - - const baseUrl = api.runtime.baseUrl.useQuery(); - - return ( - - - - - Connect an organization - - - Select an organization to integrate with Ctrlplane. - - -
-
- - - - - - - - - - {githubOrgs.data - ?.filter( - (org) => - !githubOrgsInstalled.data?.some( - (o) => - o.github_organization.organizationName === - org.login && - o.github_organization.connected === true, - ), - ) - .map(({ id, login, avatar_url }) => ( - { - setValue(currentValue); - setImage(avatar_url); - setOpen(false); - }} - > -
- - - - {login.slice(0, 2)} - - - {login} -
-
- ))} - - - - - Add new organization - - -
-
-
-
-
- - -
-
-
- - - {(loading || githubOrgsInstalled.isLoading) && ( -
- {_.range(3).map((i) => ( - - ))} -
- )} - {!loading && !githubOrgsInstalled.isLoading && ( - - {githubOrgsInstalled.data?.map( - ({ github_organization, github_user }) => ( -
-
- - - - - - -
-

- {github_organization.organizationName} -

- {github_user != null && ( -

- Enabled by {github_user.githubUsername} on{" "} - {github_organization.createdAt.toLocaleDateString()} -

- )} -
-
- - - - - - - { - e.preventDefault(); - window.open( - e.currentTarget.href, - "_blank", - "noopener,noreferrer", - ); - }} - > - Configure - - - { - githubOrgUpdate.mutateAsync({ - id: github_organization.id, - data: { - connected: false, - }, - }); - }} - > - Disconnect - - - -
- ), - )} -
- )} -
- ); -}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx index b40cf572..cffd9efa 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx @@ -3,13 +3,14 @@ import { useRouter } from "next/navigation"; import { useSession } from "next-auth/react"; import { SiGithub } from "react-icons/si"; +import { TbLoader2 } from "react-icons/tb"; import { Button } from "@ctrlplane/ui/button"; import { Card } from "@ctrlplane/ui/card"; import { api } from "~/trpc/react"; import { GithubConfigFileSync } from "./GithubConfigFile"; -import { GithubOrgConfig } from "./GithubOrgConfig"; +import { GithubConnectedOrgs } from "./GithubConnectedOrgs"; const githubAuthUrl = ( baseUrl: string, @@ -43,11 +44,17 @@ export default function GitHubIntegrationPage({ enabled: session.status === "authenticated", }); + const deleteGithubUser = api.github.user.delete.useMutation(); + const configFiles = api.github.configFile.list.useQuery( workspace.data?.id ?? "", { enabled: workspace.data != null }, ); + const loading = workspace.isLoading || githubUser.isLoading; + + const utils = api.useUtils(); + return (
@@ -61,57 +68,80 @@ export default function GitHubIntegrationPage({
- -
-

- {githubUser.data != null - ? "Personal account connected" - : "Connect your personal account"} -

-

- {githubUser.data != null - ? "Your GitHub account is connected to Ctrlplane" - : "Connect your GitHub account to Ctrlplane"} -

+ {loading && ( +
+
- {githubUser.data == null && ( - - )} - {githubUser.data != null && ( - - )} - - - {isGithubConfigured && ( - )} - + {!loading && ( +
+ +
+

+ {githubUser.data != null + ? "Personal account connected" + : "Connect your personal account"} +

+

+ {githubUser.data != null + ? "Your GitHub account is connected to Ctrlplane" + : "Connect your GitHub account to Ctrlplane to add Github organizations to your workspaces"} +

+
+ {githubUser.data == null && ( + + )} + {githubUser.data != null && ( + + )} +
+ + {isGithubConfigured && ( + + )} + + +
+ )}
); } diff --git a/apps/webservice/src/app/api/github/installation/route.ts b/apps/webservice/src/app/api/github/installation/route.ts new file mode 100644 index 00000000..ee3570c2 --- /dev/null +++ b/apps/webservice/src/app/api/github/installation/route.ts @@ -0,0 +1,162 @@ +import type { NextRequest } from "next/server"; +import { NextResponse } from "next/server"; +import { createAppAuth } from "@octokit/auth-app"; +import { Octokit } from "@octokit/rest"; +import { + BAD_REQUEST, + INTERNAL_SERVER_ERROR, + NOT_FOUND, + UNAUTHORIZED, +} from "http-status"; + +import { auth } from "@ctrlplane/auth"; +import { eq, takeFirstOrNull } from "@ctrlplane/db"; +import { db } from "@ctrlplane/db/client"; +import { user, workspace } from "@ctrlplane/db/schema"; + +import { env } from "~/env"; +import { api } from "~/trpc/server"; + +const octokit = + env.GITHUB_BOT_APP_ID == null + ? null + : new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + }, + }); + +const getOctokitInstallation = (installationId: number) => + octokit == null + ? null + : new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + installationId, + }, + }); + +export const GET = async (req: NextRequest) => { + if (octokit == null) + return NextResponse.json( + { error: "GitHub bot not configured" }, + { status: INTERNAL_SERVER_ERROR }, + ); + + const { searchParams } = new URL(req.url); + const installationId = searchParams.get("installation_id"); + const setupAction = searchParams.get("setup_action"); + + if (installationId == null || setupAction == null) + return NextResponse.json( + { error: "Installation ID or setup action not found" }, + { status: NOT_FOUND }, + ); + + if (setupAction !== "install") + return NextResponse.json( + { error: "Invalid setup action" }, + { status: BAD_REQUEST }, + ); + + const session = await auth(); + if (session == null) + return NextResponse.json( + { error: "Unauthorized" }, + { status: UNAUTHORIZED }, + ); + + const u = await db + .select() + .from(user) + .where(eq(user.id, session.user.id)) + .then(takeFirstOrNull); + if (u == null) + return NextResponse.json( + { error: "Unauthorized" }, + { status: UNAUTHORIZED }, + ); + + if (u.activeWorkspaceId == null) + return NextResponse.json( + { error: "Workspace not found" }, + { status: NOT_FOUND }, + ); + + const activeWorkspace = await db + .select() + .from(workspace) + .where(eq(workspace.id, u.activeWorkspaceId)) + .then(takeFirstOrNull); + + if (activeWorkspace == null) + return NextResponse.json( + { error: "Workspace not found" }, + { status: NOT_FOUND }, + ); + + const installation = await octokit.apps.getInstallation({ + installation_id: Number(installationId), + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }); + + if ( + installation.data.target_type !== "Organization" || + installation.data.account == null + ) { + return NextResponse.json( + { error: "Invalid installation type" }, + { status: BAD_REQUEST }, + ); + } + + const installationOctokit = getOctokitInstallation(installation.data.id); + if (installationOctokit == null) + return NextResponse.json( + { error: "Failed to get installation octokit" }, + { status: INTERNAL_SERVER_ERROR }, + ); + + const targetId = installation.data.target_id; + const orgData = await installationOctokit.orgs.get({ + org: String(targetId), + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }); + + await api.github.organizations.create({ + workspaceId: activeWorkspace.id, + installationId: installation.data.id, + organizationName: orgData.data.login, + avatarUrl: orgData.data.avatar_url, + addedByUserId: u.id, + }); + + await api.job.agent.create({ + workspaceId: activeWorkspace.id, + type: "github-app", + name: orgData.data.login, + config: { + installationId: installation.data.id, + owner: orgData.data.login, + }, + }); + + const baseUrl = await api.runtime.baseUrl(); + const workspaceSlug = activeWorkspace.slug; + + return NextResponse.redirect( + `${baseUrl}/${workspaceSlug}/settings/workspace/integrations/github`, + ); +}; diff --git a/packages/api/src/router/github/create-github-org.ts b/packages/api/src/router/github/create-github-org.ts new file mode 100644 index 00000000..891a5836 --- /dev/null +++ b/packages/api/src/router/github/create-github-org.ts @@ -0,0 +1,216 @@ +import { createAppAuth } from "@octokit/auth-app"; +import type { RestEndpointMethodTypes } from "@octokit/rest"; +import { Octokit } from "@octokit/rest"; +import * as yaml from "js-yaml"; +import { isPresent } from "ts-is-present"; + +import type { Tx } from "@ctrlplane/db"; +import { and, eq, inArray, takeFirst } from "@ctrlplane/db"; +import type { + GithubOrganization, + GithubOrganizationInsert} from "@ctrlplane/db/schema"; +import { + deployment, + githubConfigFile, + githubOrganization, + system, + workspace, +} from "@ctrlplane/db/schema"; +import { configFile } from "@ctrlplane/validators"; + +import { env } from "../../config"; + +type ConfigFile = + RestEndpointMethodTypes["search"]["code"]["response"]["data"]["items"][number]; + +type ParsedConfigFile = ConfigFile & { + content: { + deployments: { + name: string; + slug: string; + system: string; + workspace: string; + description?: string | undefined; + }[]; + }; +}; + +const octokit = + env.GITHUB_BOT_APP_ID == null + ? null + : new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + }, + }); + +const getOctokitInstallation = (installationId: number) => + new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + installationId, + }, + }); + +const parseConfigFile = async ( + cf: ConfigFile, + orgName: string, + branch: string, + installationOctokit: Octokit, +) => { + const content = await installationOctokit.repos + .getContent({ + owner: orgName, + repo: cf.repository.name, + path: cf.path, + ref: branch, + }) + .then(({ data }) => { + if (!("content" in data)) throw new Error("Invalid response data"); + return Buffer.from(data.content, "base64").toString("utf-8"); + }); + + const yamlContent = yaml.load(content); + const parsed = configFile.safeParse(yamlContent); + if (!parsed.success) throw new Error("Invalid config file"); + + return { + ...cf, + content: parsed.data, + }; +}; + +const processParsedConfigFiles = async ( + db: Tx, + parsedConfigFiles: ParsedConfigFile[], + org: GithubOrganization, +) => { + const deploymentInfo = await db + .select() + .from(system) + .innerJoin(workspace, eq(system.workspaceId, workspace.id)) + .where( + and( + inArray( + system.slug, + parsedConfigFiles + .map((d) => d.content.deployments.map((d) => d.system)) + .flat(), + ), + inArray( + workspace.slug, + parsedConfigFiles + .map((d) => d.content.deployments.map((d) => d.workspace)) + .flat(), + ), + ), + ); + + const insertedConfigFiles = await db + .insert(githubConfigFile) + .values( + parsedConfigFiles.map((d) => ({ + ...d, + workspaceId: org.workspaceId, + organizationId: org.id, + repositoryName: d.repository.name, + })), + ) + .returning(); + + const deployments = parsedConfigFiles + .map((cf) => + cf.content.deployments.map((d) => { + const info = deploymentInfo.find( + (i) => i.system.slug === d.system && i.workspace.slug === d.workspace, + ); + if (info == null) throw new Error("Deployment info not found"); + const { system, workspace } = info; + + return { + ...d, + systemId: system.id, + workspaceId: workspace.id, + description: d.description ?? "", + githubConfigFileId: insertedConfigFiles.find( + (icf) => + icf.path === cf.path && icf.repositoryName === cf.repository.name, + )?.id, + }; + }), + ) + .flat(); + + await db.insert(deployment).values(deployments); +}; + +export const createNewGithubOrganization = async ( + db: Tx, + githubOrganizationConfig: GithubOrganizationInsert, +) => + db.transaction(async (db) => { + const org = await db + .insert(githubOrganization) + .values(githubOrganizationConfig) + .returning() + .then(takeFirst); + + const installation = await octokit?.apps.getInstallation({ + installation_id: org.installationId, + }); + if (installation == null) throw new Error("Failed to get installation"); + + const installationOctokit = getOctokitInstallation(installation.data.id); + const installationToken = (await installationOctokit.auth({ + type: "installation", + installationId: installation.data.id, + })) as { token: string }; + + const configFiles = await Promise.all([ + installationOctokit.search.code({ + q: `org:${org.organizationName} filename:ctrlplane.yaml`, + per_page: 100, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + authorization: `Bearer ${installationToken.token}`, + }, + }), + installationOctokit.search.code({ + q: `org:${org.organizationName} filename:ctrlplane.yml`, + per_page: 100, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + authorization: `Bearer ${installationToken.token}`, + }, + }), + ]).then((responses) => { + return [...responses[0].data.items, ...responses[1].data.items]; + }); + + if (configFiles.length === 0) return; + + const parsedConfigFiles = await Promise.allSettled( + configFiles.map((cf) => + parseConfigFile( + cf, + org.organizationName, + org.branch, + installationOctokit, + ), + ), + ).then((results) => + results + .map((r) => (r.status === "fulfilled" ? r.value : null)) + .filter(isPresent), + ); + + await processParsedConfigFiles(db, parsedConfigFiles, org); + }); diff --git a/packages/api/src/router/github/github.ts b/packages/api/src/router/github/github.ts new file mode 100644 index 00000000..338ea436 --- /dev/null +++ b/packages/api/src/router/github/github.ts @@ -0,0 +1,273 @@ +import { createAppAuth } from "@octokit/auth-app"; +import { Octokit } from "@octokit/rest"; +import { TRPCError } from "@trpc/server"; +import _ from "lodash"; +import { isPresent } from "ts-is-present"; +import { z } from "zod"; + +import { eq, takeFirstOrNull } from "@ctrlplane/db"; +import { + githubConfigFile, + githubOrganization, + githubOrganizationInsert, + githubUser, +} from "@ctrlplane/db/schema"; + +import { env } from "../../config"; +import { createTRPCRouter, protectedProcedure } from "../../trpc"; +import { createNewGithubOrganization } from "./create-github-org"; + +const octokit = + env.GITHUB_BOT_APP_ID == null + ? null + : new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + }, + }); + +const getOctokitInstallation = (installationId: number) => + new Octokit({ + authStrategy: createAppAuth, + auth: { + appId: env.GITHUB_BOT_APP_ID, + privateKey: env.GITHUB_BOT_PRIVATE_KEY, + clientId: env.GITHUB_BOT_CLIENT_ID, + clientSecret: env.GITHUB_BOT_CLIENT_SECRET, + installationId, + }, + }); + +const getOctokit = () => { + if (octokit == null) + throw new TRPCError({ + code: "INTERNAL_SERVER_ERROR", + message: "GitHub bot not configured", + }); + return octokit; +}; + +const userRouter = createTRPCRouter({ + byUserId: protectedProcedure + .input(z.string()) + .query(({ ctx, input }) => + ctx.db + .select() + .from(githubUser) + .where(eq(githubUser.userId, input)) + .then(takeFirstOrNull), + ), + + create: protectedProcedure + .input( + z.object({ + userId: z.string(), + githubUserId: z.number(), + githubUsername: z.string(), + }), + ) + .mutation(({ ctx, input }) => + ctx.db + .insert(githubUser) + .values(input) + .returning() + .then((data) => data[0]), + ), + + delete: protectedProcedure + .input(z.string().uuid()) + .mutation(async ({ ctx, input }) => + ctx.db.delete(githubUser).where(eq(githubUser.userId, input)), + ), +}); + +const reposRouter = createTRPCRouter({ + list: protectedProcedure + .input(z.object({ installationId: z.number(), login: z.string() })) + .query(({ input }) => + octokit?.apps + .getInstallation({ + installation_id: input.installationId, + }) + .then(async ({ data: installation }) => { + const installationOctokit = getOctokitInstallation(installation.id); + const installationToken = (await installationOctokit.auth({ + type: "installation", + installationId: installation.id, + })) as { token: string }; + + return installationOctokit.repos.listForOrg({ + org: input.login, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + authorization: `Bearer ${installationToken.token}`, + }, + }); + }), + ), + + workflows: createTRPCRouter({ + list: protectedProcedure + .input( + z.object({ + installationId: z.number(), + login: z.string(), + repo: z.string(), + }), + ) + .query(async ({ input }) => { + const installationOctokit = getOctokitInstallation( + input.installationId, + ); + + const installationToken = (await installationOctokit.auth({ + type: "installation", + installationId: input.installationId, + })) as { token: string }; + + return installationOctokit.actions.listRepoWorkflows({ + owner: input.login, + repo: input.repo, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + authorization: `Bearer ${installationToken.token}`, + }, + }); + }), + }), +}); + +const configFileRouter = createTRPCRouter({ + list: protectedProcedure + .meta({ + access: ({ ctx, input }) => ctx.accessQuery().workspace.id(input), + }) + .input(z.string().uuid()) + .query(({ ctx, input }) => + ctx.db + .select() + .from(githubConfigFile) + .where(eq(githubConfigFile.workspaceId, input)), + ), +}); + +export const githubRouter = createTRPCRouter({ + user: userRouter, + + configFile: configFileRouter, + + organizations: createTRPCRouter({ + byGithubUserId: protectedProcedure.input(z.number()).query(({ input }) => + getOctokit() + .apps.listInstallations({ + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }) + .then(({ data: installations }) => + Promise.all( + installations + .filter((i) => i.target_type === "Organization") + .map(async (i) => { + const installationOctokit = getOctokitInstallation(i.id); + + const installationToken = (await installationOctokit.auth({ + type: "installation", + installationId: i.id, + })) as { token: string }; + + const members = await installationOctokit.orgs.listMembers({ + org: i.account?.login ?? "", + headers: { + "X-GitHub-Api-Version": "2022-11-28", + authorization: `Bearer ${installationToken.token}`, + }, + }); + + const isUserInGithubOrg = + members.data.find((m) => m.id === input) != null; + if (!isUserInGithubOrg) return null; + + const orgData = await installationOctokit.orgs.get({ + org: i.account?.login ?? "", + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }); + return _.merge(orgData.data, { installationId: i.id }); + }), + ).then((orgs) => orgs.filter(isPresent)), + ), + ), + + byWorkspaceId: protectedProcedure + .input(z.string().uuid()) + .query(async ({ ctx, input }) => { + const internalOrgs = await ctx.db + .select() + .from(githubOrganization) + .where(eq(githubOrganization.workspaceId, input)); + + return getOctokit() + .apps.listInstallations({ + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }) + .then(({ data: installations }) => + Promise.all( + installations.filter( + (i) => + i.target_type === "Organization" && + internalOrgs.find((org) => org.installationId === i.id) != + null, + ), + ), + ); + }), + + list: protectedProcedure + .input(z.string().uuid()) + .query(({ ctx, input }) => + ctx.db + .select() + .from(githubOrganization) + .leftJoin( + githubUser, + eq(githubOrganization.addedByUserId, githubUser.userId), + ) + .where(eq(githubOrganization.workspaceId, input)), + ), + + create: protectedProcedure + .input(githubOrganizationInsert) + .mutation(({ ctx, input }) => createNewGithubOrganization(ctx.db, input)), + + update: protectedProcedure + .input( + z.object({ + id: z.string().uuid(), + data: z.object({ + connected: z.boolean().optional(), + installationId: z.number().optional(), + organizationName: z.string().optional(), + organizationId: z.string().optional(), + addedByUserId: z.string().optional(), + workspaceId: z.string().optional(), + }), + }), + ) + .mutation(({ ctx, input }) => + ctx.db + .update(githubOrganization) + .set(input.data) + .where(eq(githubOrganization.id, input.id)), + ), + + repos: reposRouter, + }), +}); diff --git a/packages/db/src/schema/github.ts b/packages/db/src/schema/github.ts index f3ab02ff..f09931ed 100644 --- a/packages/db/src/schema/github.ts +++ b/packages/db/src/schema/github.ts @@ -1,4 +1,4 @@ -import type { InferSelectModel } from "drizzle-orm"; +import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; import { boolean, integer, @@ -43,6 +43,9 @@ export const githubOrganization = pgTable("github_organization", { }); export type GithubOrganization = InferSelectModel; +export type GithubOrganizationInsert = InferInsertModel< + typeof githubOrganization +>; export const githubOrganizationInsert = createInsertSchema(githubOrganization); From d89ce357bf9253c5deac6c7a7af91dce7e37e838 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 5 Sep 2024 23:00:22 -0700 Subject: [PATCH 02/21] fix --- packages/api/src/root.ts | 2 +- packages/api/src/router/github.ts | 426 ----------------------- packages/api/src/router/github/github.ts | 12 +- 3 files changed, 7 insertions(+), 433 deletions(-) delete mode 100644 packages/api/src/router/github.ts diff --git a/packages/api/src/root.ts b/packages/api/src/root.ts index 94d836e3..bb8afd7a 100644 --- a/packages/api/src/root.ts +++ b/packages/api/src/root.ts @@ -1,7 +1,7 @@ import { dashboardRouter } from "./router/dashboard"; import { deploymentRouter } from "./router/deployment"; import { environmentRouter } from "./router/environment"; -import { githubRouter } from "./router/github"; +import { githubRouter } from "./router/github/github"; import { invitesRouter } from "./router/invite"; import { jobRouter } from "./router/job"; import { releaseRouter } from "./router/release"; diff --git a/packages/api/src/router/github.ts b/packages/api/src/router/github.ts deleted file mode 100644 index fc02231d..00000000 --- a/packages/api/src/router/github.ts +++ /dev/null @@ -1,426 +0,0 @@ -import { createAppAuth } from "@octokit/auth-app"; -import { Octokit } from "@octokit/rest"; -import { TRPCError } from "@trpc/server"; -import * as yaml from "js-yaml"; -import _ from "lodash"; -import { isPresent } from "ts-is-present"; -import { z } from "zod"; - -import { and, eq, inArray, takeFirst, takeFirstOrNull } from "@ctrlplane/db"; -import { - deployment, - githubConfigFile, - githubOrganization, - githubOrganizationInsert, - githubUser, - system, - workspace, -} from "@ctrlplane/db/schema"; -import { configFile } from "@ctrlplane/validators"; - -import { env } from "../config"; -import { createTRPCRouter, protectedProcedure } from "../trpc"; - -const octokit = - env.GITHUB_BOT_APP_ID == null - ? null - : new Octokit({ - authStrategy: createAppAuth, - auth: { - appId: env.GITHUB_BOT_APP_ID, - privateKey: env.GITHUB_BOT_PRIVATE_KEY, - clientId: env.GITHUB_BOT_CLIENT_ID, - clientSecret: env.GITHUB_BOT_CLIENT_SECRET, - }, - }); - -const getOctokitInstallation = (installationId: number) => - new Octokit({ - authStrategy: createAppAuth, - auth: { - appId: env.GITHUB_BOT_APP_ID, - privateKey: env.GITHUB_BOT_PRIVATE_KEY, - clientId: env.GITHUB_BOT_CLIENT_ID, - clientSecret: env.GITHUB_BOT_CLIENT_SECRET, - installationId, - }, - }); - -const getOctokit = () => { - if (octokit == null) - throw new TRPCError({ - code: "INTERNAL_SERVER_ERROR", - message: "GitHub bot not configured", - }); - return octokit; -}; - -const userRouter = createTRPCRouter({ - byUserId: protectedProcedure - .input(z.string()) - .query(({ ctx, input }) => - ctx.db - .select() - .from(githubUser) - .where(eq(githubUser.userId, input)) - .then(takeFirstOrNull), - ), - - create: protectedProcedure - .input( - z.object({ - userId: z.string(), - githubUserId: z.number(), - githubUsername: z.string(), - }), - ) - .mutation(({ ctx, input }) => - ctx.db - .insert(githubUser) - .values(input) - .returning() - .then((data) => data[0]), - ), -}); - -const reposRouter = createTRPCRouter({ - list: protectedProcedure - .input(z.object({ installationId: z.number(), login: z.string() })) - .query(({ input }) => - octokit?.apps - .getInstallation({ - installation_id: input.installationId, - }) - .then(async ({ data: installation }) => { - const installationOctokit = getOctokitInstallation(installation.id); - const installationToken = (await installationOctokit.auth({ - type: "installation", - installationId: installation.id, - })) as { token: string }; - - return installationOctokit.repos.listForOrg({ - org: input.login, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - authorization: `Bearer ${installationToken.token}`, - }, - }); - }), - ), - - workflows: createTRPCRouter({ - list: protectedProcedure - .input( - z.object({ - installationId: z.number(), - login: z.string(), - repo: z.string(), - }), - ) - .query(async ({ input }) => { - const installationOctokit = getOctokitInstallation( - input.installationId, - ); - - const installationToken = (await installationOctokit.auth({ - type: "installation", - installationId: input.installationId, - })) as { token: string }; - - return installationOctokit.actions.listRepoWorkflows({ - owner: input.login, - repo: input.repo, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - authorization: `Bearer ${installationToken.token}`, - }, - }); - }), - }), -}); - -const configFileRouter = createTRPCRouter({ - list: protectedProcedure - .meta({ - access: ({ ctx, input }) => ctx.accessQuery().workspace.id(input), - }) - .input(z.string().uuid()) - .query(({ ctx, input }) => - ctx.db - .select() - .from(githubConfigFile) - .where(eq(githubConfigFile.workspaceId, input)), - ), -}); - -export const githubRouter = createTRPCRouter({ - user: userRouter, - - configFile: configFileRouter, - - organizations: createTRPCRouter({ - byGithubUserId: protectedProcedure.input(z.number()).query(({ input }) => - getOctokit() - .apps.listInstallations({ - headers: { - "X-GitHub-Api-Version": "2022-11-28", - }, - }) - .then(({ data: installations }) => - Promise.all( - installations - .filter((i) => i.target_type === "Organization") - .map(async (i) => { - const installationOctokit = getOctokitInstallation(i.id); - - const installationToken = (await installationOctokit.auth({ - type: "installation", - installationId: i.id, - })) as { token: string }; - - const members = await installationOctokit.orgs.listMembers({ - org: i.account?.login ?? "", - headers: { - "X-GitHub-Api-Version": "2022-11-28", - authorization: `Bearer ${installationToken.token}`, - }, - }); - - const isUserInGithubOrg = - members.data.find((m) => m.id === input) != null; - if (!isUserInGithubOrg) return null; - - const orgData = await installationOctokit.orgs.get({ - org: i.account?.login ?? "", - headers: { - "X-GitHub-Api-Version": "2022-11-28", - }, - }); - return _.merge(orgData.data, { installationId: i.id }); - }), - ).then((orgs) => orgs.filter(isPresent)), - ), - ), - - byWorkspaceId: protectedProcedure - .input(z.string().uuid()) - .query(async ({ ctx, input }) => { - const internalOrgs = await ctx.db - .select() - .from(githubOrganization) - .where(eq(githubOrganization.workspaceId, input)); - - return getOctokit() - .apps.listInstallations({ - headers: { - "X-GitHub-Api-Version": "2022-11-28", - }, - }) - .then(({ data: installations }) => - Promise.all( - installations.filter( - (i) => - i.target_type === "Organization" && - internalOrgs.find((org) => org.installationId === i.id) != - null, - ), - ), - ); - }), - - list: protectedProcedure - .input(z.string().uuid()) - .query(({ ctx, input }) => - ctx.db - .select() - .from(githubOrganization) - .leftJoin( - githubUser, - eq(githubOrganization.addedByUserId, githubUser.userId), - ) - .where(eq(githubOrganization.workspaceId, input)), - ), - - create: protectedProcedure - .input(githubOrganizationInsert) - .mutation(({ ctx, input }) => - ctx.db.transaction((db) => - db - .insert(githubOrganization) - .values(input) - .returning() - .then(takeFirst) - .then((org) => - getOctokit() - .apps.getInstallation({ - installation_id: org.installationId, - }) - .then(async ({ data: installation }) => { - const installationOctokit = getOctokitInstallation( - installation.id, - ); - - const installationToken = (await installationOctokit.auth({ - type: "installation", - installationId: installation.id, - })) as { token: string }; - - const configFiles = await Promise.all([ - installationOctokit.search.code({ - q: `org:${org.organizationName} filename:ctrlplane.yaml`, - per_page: 100, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - authorization: `Bearer ${installationToken.token}`, - }, - }), - installationOctokit.search.code({ - q: `org:${org.organizationName} filename:ctrlplane.yml`, - per_page: 100, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - authorization: `Bearer ${installationToken.token}`, - }, - }), - ]).then((responses) => { - return [ - ...responses[0].data.items, - ...responses[1].data.items, - ]; - }); - - if (configFiles.length === 0) return []; - - const parsedConfigFiles = await Promise.allSettled( - configFiles.map(async (cf) => { - const content = await installationOctokit.repos - .getContent({ - owner: org.organizationName, - repo: cf.repository.name, - path: cf.path, - ref: org.branch, - }) - .then(({ data }) => { - if (!("content" in data)) - throw new Error("Invalid response data"); - return Buffer.from(data.content, "base64").toString( - "utf-8", - ); - }); - - const yamlContent = yaml.load(content); - const parsed = configFile.safeParse(yamlContent); - if (!parsed.success) - throw new TRPCError({ - code: "BAD_REQUEST", - message: "Invalid config file", - }); - - return { - ...cf, - content: parsed.data, - }; - }), - ).then((results) => - results - .map((r) => (r.status === "fulfilled" ? r.value : null)) - .filter(isPresent), - ); - - const deploymentInfo = await db - .select() - .from(system) - .innerJoin(workspace, eq(system.workspaceId, workspace.id)) - .where( - and( - inArray( - system.slug, - parsedConfigFiles - .map((d) => - d.content.deployments.map((d) => d.system), - ) - .flat(), - ), - inArray( - workspace.slug, - parsedConfigFiles - .map((d) => - d.content.deployments.map((d) => d.workspace), - ) - .flat(), - ), - ), - ); - - const insertedConfigFiles = await db - .insert(githubConfigFile) - .values( - parsedConfigFiles.map((d) => ({ - ...d, - workspaceId: org.workspaceId, - organizationId: org.id, - repositoryName: d.repository.name, - })), - ) - .returning(); - - const deployments = parsedConfigFiles - .map((cf) => - cf.content.deployments.map((d) => { - const info = deploymentInfo.find( - (i) => - i.system.slug === d.system && - i.workspace.slug === d.workspace, - ); - if (info == null) - throw new TRPCError({ - code: "NOT_FOUND", - message: "Deployment info not found", - }); - const { system, workspace } = info; - - return { - ...d, - systemId: system.id, - workspaceId: workspace.id, - description: d.description ?? "", - githubConfigFileId: insertedConfigFiles.find( - (icf) => - icf.path === cf.path && - icf.repositoryName === cf.repository.name, - )?.id, - }; - }), - ) - .flat(); - - return db.insert(deployment).values(deployments); - }), - ), - ), - ), - - update: protectedProcedure - .input( - z.object({ - id: z.string().uuid(), - data: z.object({ - connected: z.boolean().optional(), - installationId: z.number().optional(), - organizationName: z.string().optional(), - organizationId: z.string().optional(), - addedByUserId: z.string().optional(), - workspaceId: z.string().optional(), - }), - }), - ) - .mutation(({ ctx, input }) => - ctx.db - .update(githubOrganization) - .set(input.data) - .where(eq(githubOrganization.id, input.id)), - ), - - repos: reposRouter, - }), -}); diff --git a/packages/api/src/router/github/github.ts b/packages/api/src/router/github/github.ts index 338ea436..0ba8553e 100644 --- a/packages/api/src/router/github/github.ts +++ b/packages/api/src/router/github/github.ts @@ -62,6 +62,12 @@ const userRouter = createTRPCRouter({ .then(takeFirstOrNull), ), + delete: protectedProcedure + .input(z.string()) + .mutation(async ({ ctx, input }) => + ctx.db.delete(githubUser).where(eq(githubUser.userId, input)), + ), + create: protectedProcedure .input( z.object({ @@ -77,12 +83,6 @@ const userRouter = createTRPCRouter({ .returning() .then((data) => data[0]), ), - - delete: protectedProcedure - .input(z.string().uuid()) - .mutation(async ({ ctx, input }) => - ctx.db.delete(githubUser).where(eq(githubUser.userId, input)), - ), }); const reposRouter = createTRPCRouter({ From 0b05f480ce86bdcd6ac5ce891f96497558eb1040 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 5 Sep 2024 23:05:02 -0700 Subject: [PATCH 03/21] use type instead of interface --- .../integrations/(integration)/github/GithubAddOrgDialog.tsx | 4 ++-- .../integrations/(integration)/github/GithubConnectedOrgs.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx index d4301a03..cf3d8c4b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx @@ -25,7 +25,7 @@ import { Separator } from "@ctrlplane/ui/separator"; import { api } from "~/trpc/react"; -interface GithubAddOrgDialogProps { +type GithubAddOrgDialogProps = { githubUserId: number; children: React.ReactNode; githubConfig: { @@ -35,7 +35,7 @@ interface GithubAddOrgDialogProps { }; workspaceId: string; workspaceSlug: string; -} +}; export const GithubAddOrgDialog: React.FC = ({ githubUserId, diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx index 405a34d4..a322793f 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx @@ -24,7 +24,7 @@ import { Skeleton } from "@ctrlplane/ui/skeleton"; import { api } from "~/trpc/react"; import { GithubAddOrgDialog } from "./GithubAddOrgDialog"; -interface GithubConnectedOrgsProps { +type GithubConnectedOrgsProps = { githubUser?: GithubUser | null; workspaceSlug?: string; workspaceId?: string; @@ -34,7 +34,7 @@ interface GithubConnectedOrgsProps { botName: string; clientId: string; }; -} +}; export const GithubConnectedOrgs: React.FC = ({ githubUser, From bbdab06d74af2477999bfd940cf209a6c9bd1580 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 5 Sep 2024 23:11:59 -0700 Subject: [PATCH 04/21] format --- packages/api/src/router/github/create-github-org.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/api/src/router/github/create-github-org.ts b/packages/api/src/router/github/create-github-org.ts index 891a5836..ebf326c8 100644 --- a/packages/api/src/router/github/create-github-org.ts +++ b/packages/api/src/router/github/create-github-org.ts @@ -1,14 +1,15 @@ -import { createAppAuth } from "@octokit/auth-app"; +import type { Tx } from "@ctrlplane/db"; +import type { + GithubOrganization, + GithubOrganizationInsert, +} from "@ctrlplane/db/schema"; import type { RestEndpointMethodTypes } from "@octokit/rest"; +import { createAppAuth } from "@octokit/auth-app"; import { Octokit } from "@octokit/rest"; import * as yaml from "js-yaml"; import { isPresent } from "ts-is-present"; -import type { Tx } from "@ctrlplane/db"; import { and, eq, inArray, takeFirst } from "@ctrlplane/db"; -import type { - GithubOrganization, - GithubOrganizationInsert} from "@ctrlplane/db/schema"; import { deployment, githubConfigFile, From a45978e99e367bca505b19898c4baf7e3b280d42 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Fri, 6 Sep 2024 18:15:30 -0700 Subject: [PATCH 05/21] more changes/cleanup --- .../github/DeleteGithubUserButton.tsx | 23 + .../github/GithubAddOrgDialog.tsx | 46 +- .../github/GithubConnectedOrgs.tsx | 135 +- .../github/GithubRemoveOrgDialog.tsx | 111 + .../github/OrgActionDropdown.tsx | 58 + .../(integration)/github/page.tsx | 169 +- .../integrations/(integration)/layout.tsx | 20 +- .../job-agent/ConfigureJobAgentGithub.tsx | 8 +- .../github/[userId]/[workspaceSlug]/route.ts | 4 +- .../src/app/api/github/installation/route.ts | 2 +- .../[workspaceSlug]/route.ts | 4 +- apps/webservice/src/env.ts | 3 + .../src/router/github/create-github-org.ts | 12 +- packages/api/src/router/github/github.ts | 114 +- packages/api/src/router/runtime.ts | 7 - packages/db/drizzle/0007_thick_proteus.sql | 10 + .../db/drizzle/0008_gigantic_kat_farrell.sql | 7 + packages/db/drizzle/meta/0007_snapshot.json | 2589 +++++++++++++++++ packages/db/drizzle/meta/0008_snapshot.json | 2589 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 14 + packages/db/src/schema/deployment.ts | 6 +- packages/db/src/schema/github.ts | 43 +- 22 files changed, 5693 insertions(+), 281 deletions(-) create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/DeleteGithubUserButton.tsx create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubRemoveOrgDialog.tsx create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/OrgActionDropdown.tsx create mode 100644 packages/db/drizzle/0007_thick_proteus.sql create mode 100644 packages/db/drizzle/0008_gigantic_kat_farrell.sql create mode 100644 packages/db/drizzle/meta/0007_snapshot.json create mode 100644 packages/db/drizzle/meta/0008_snapshot.json diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/DeleteGithubUserButton.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/DeleteGithubUserButton.tsx new file mode 100644 index 00000000..9a301d0f --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/DeleteGithubUserButton.tsx @@ -0,0 +1,23 @@ +"use client"; + +import { useRouter } from "next/navigation"; + +import { Button } from "@ctrlplane/ui/button"; + +import { api } from "~/trpc/react"; + +export const DeleteGithubUserButton: React.FC<{ githubUserId: string }> = ({ + githubUserId, +}) => { + const deleteGithubUser = api.github.user.delete.useMutation(); + const router = useRouter(); + + const handleDelete = () => + deleteGithubUser.mutateAsync(githubUserId).then(() => router.refresh()); + + return ( + + ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx index cf3d8c4b..d20aba22 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx @@ -1,5 +1,8 @@ +"use client"; + import { useState } from "react"; import Link from "next/link"; +import { useRouter } from "next/navigation"; import { TbBulb } from "react-icons/tb"; import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; @@ -26,7 +29,10 @@ import { Separator } from "@ctrlplane/ui/separator"; import { api } from "~/trpc/react"; type GithubAddOrgDialogProps = { - githubUserId: number; + githubUser?: { + githubUserId: number; + userId: string; + }; children: React.ReactNode; githubConfig: { url: string; @@ -38,16 +44,17 @@ type GithubAddOrgDialogProps = { }; export const GithubAddOrgDialog: React.FC = ({ - githubUserId, + githubUser, children, githubConfig, workspaceId, }) => { const [open, setOpen] = useState(false); const [popoverOpen, setPopoverOpen] = useState(false); - const githubOrgs = - api.github.organizations.byGithubUserId.useQuery(githubUserId); - + const githubOrgs = api.github.organizations.byGithubUserId.useQuery( + githubUser?.githubUserId ?? 0, + ); + const router = useRouter(); const githubOrgsInstalled = api.github.organizations.list.useQuery(workspaceId); @@ -55,15 +62,31 @@ export const GithubAddOrgDialog: React.FC = ({ githubOrgs.data?.filter( (org) => !githubOrgsInstalled.data?.some( - (o) => - o.github_organization.organizationName === org.login && - o.github_organization.connected === true, + (o) => o.organizationName === org.login, ), ) ?? []; + const githubOrgCreate = api.github.organizations.create.useMutation(); + const [image, setImage] = useState(null); const [value, setValue] = useState(null); + const handlePreconnectedOrgSave = () => { + if (value == null) return; + const org = validOrgsToAdd.find((o) => o.login === value); + if (org == null) return; + + githubOrgCreate + .mutateAsync({ + installationId: org.installationId, + workspaceId, + organizationName: org.login, + addedByUserId: githubUser?.userId ?? "", + avatarUrl: org.avatar_url, + }) + .then(() => router.refresh()); + }; + return ( {children} @@ -175,7 +198,12 @@ export const GithubAddOrgDialog: React.FC = ({ )} - + diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx index a322793f..19f378ba 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx @@ -1,8 +1,6 @@ import type { GithubUser } from "@ctrlplane/db/schema"; -import Link from "next/link"; -import _ from "lodash"; import { SiGithub } from "react-icons/si"; -import { TbChevronDown, TbPlus } from "react-icons/tb"; +import { TbPlus } from "react-icons/tb"; import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; import { Button } from "@ctrlplane/ui/button"; @@ -12,17 +10,11 @@ import { CardHeader, CardTitle, } from "@ctrlplane/ui/card"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@ctrlplane/ui/dropdown-menu"; import { Separator } from "@ctrlplane/ui/separator"; -import { Skeleton } from "@ctrlplane/ui/skeleton"; -import { api } from "~/trpc/react"; +import { api } from "~/trpc/server"; import { GithubAddOrgDialog } from "./GithubAddOrgDialog"; +import { OrgActionDropdown } from "./OrgActionDropdown"; type GithubConnectedOrgsProps = { githubUser?: GithubUser | null; @@ -36,17 +28,15 @@ type GithubConnectedOrgsProps = { }; }; -export const GithubConnectedOrgs: React.FC = ({ +export const GithubConnectedOrgs: React.FC = async ({ githubUser, workspaceSlug, workspaceId, githubConfig, }) => { - const githubOrgsInstalled = api.github.organizations.list.useQuery( + const githubOrgsInstalled = await api.github.organizations.list( workspaceId ?? "", - { enabled: workspaceId != null }, ); - const githubOrgUpdate = api.github.organizations.update.useMutation(); return ( @@ -61,7 +51,7 @@ export const GithubConnectedOrgs: React.FC = ({ = ({ - {githubOrgsInstalled.isLoading && ( -
- {_.range(3).map((i) => ( - - ))} -
- )} - {githubOrgsInstalled.data != null && - githubOrgsInstalled.data.length > 0 && ( - <> - -
- {githubOrgsInstalled.data.map( - ({ github_organization, github_user }) => ( -
-
- - - - - - -
-

- {github_organization.organizationName} -

- {github_user != null && ( -

- Enabled by {github_user.githubUsername} on{" "} - {github_organization.createdAt.toLocaleDateString()} -

- )} -
-
- - - - - - - - Configure - - - { - githubOrgUpdate.mutateAsync({ - id: github_organization.id, - data: { - connected: false, - }, - }); - }} - > - Disconnect - - - + {githubOrgsInstalled.length > 0 && ( + <> + +
+ {githubOrgsInstalled.map((org) => ( +
+
+ + + + + + +
+

+ {org.organizationName} +

+ {org.addedByUser != null && ( +

+ Enabled by {org.addedByUser.githubUsername} on{" "} + {org.createdAt.toLocaleDateString()} +

+ )}
- ), - )} -
- - )} +
+ +
+ ))} +
+ + )} ); }; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubRemoveOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubRemoveOrgDialog.tsx new file mode 100644 index 00000000..d0d7ecab --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubRemoveOrgDialog.tsx @@ -0,0 +1,111 @@ +import type { + Deployment, + GithubConfigFile, + GithubOrganization, +} from "@ctrlplane/db/schema"; +import { useRouter } from "next/navigation"; + +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@ctrlplane/ui/alert-dialog"; +import { Badge } from "@ctrlplane/ui/badge"; +import { buttonVariants } from "@ctrlplane/ui/button"; + +import { api } from "~/trpc/react"; + +interface GithubConfigFileWithDeployments extends GithubConfigFile { + deployments: Deployment[]; +} + +export interface GithubOrganizationWithConfigFiles extends GithubOrganization { + configFiles: GithubConfigFileWithDeployments[]; +} + +type GithubRemoveOrgDialogProps = { + githubOrganization: GithubOrganizationWithConfigFiles; + children: React.ReactNode; +}; + +export const GithubRemoveOrgDialog: React.FC = ({ + githubOrganization, + children, +}) => { + const router = useRouter(); + const githubOrgDelete = api.github.organizations.delete.useMutation(); + + const handleDelete = (deleteResources: boolean) => { + githubOrgDelete + .mutateAsync({ + id: githubOrganization.id, + deleteDeployments: deleteResources, + }) + .then(() => router.refresh()); + }; + + return ( + + {children} + + + Are you sure? + {githubOrganization.configFiles.length > 0 ? ( + +

You have two options for deletion:

+
    +
  1. + Disconnect only the organization: Any + resources generated from a{" "} + + ctrlplane.yaml + {" "} + config file associated with this organization will remain, but + will no longer be synced with changes to the source file. +
  2. +
  3. + Disconnect and delete all resources: This + action is irreversible and will permanently remove the + organization along with all associated resources. This + includes all resources generated from a{" "} + + ctrlplane.yaml + {" "} + config file in a repo within your Github organization. +
  4. +
+
+ ) : ( + + Disconnecting the organization will remove the connection between + Ctrlplane and your Github organization for this workspace. + + )} +
+ + Cancel + handleDelete(false)} + > + Disconnect {githubOrganization.configFiles.length > 0 && "only"} + + {githubOrganization.configFiles.length > 0 && ( + handleDelete(true)} + > + Disconnect and delete + + )} + +
+
+ ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/OrgActionDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/OrgActionDropdown.tsx new file mode 100644 index 00000000..f21850b5 --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/OrgActionDropdown.tsx @@ -0,0 +1,58 @@ +"use client"; + +import Link from "next/link"; +import { TbChevronDown, TbExternalLink } from "react-icons/tb"; + +import { Button } from "@ctrlplane/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@ctrlplane/ui/dropdown-menu"; + +import type { GithubOrganizationWithConfigFiles } from "./GithubRemoveOrgDialog"; +import { GithubRemoveOrgDialog } from "./GithubRemoveOrgDialog"; + +type OrgActionDropdownProps = { + githubConfig: { + url: string; + botName: string; + clientId: string; + }; + org: GithubOrganizationWithConfigFiles; +}; + +export const OrgActionDropdown: React.FC = ({ + githubConfig, + org, +}) => { + return ( + + + + + + + + Configure + + + + + e.preventDefault()}> + Disconnect + + + + + ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx index cffd9efa..9c2adf51 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx @@ -1,14 +1,14 @@ -"use client"; - -import { useRouter } from "next/navigation"; -import { useSession } from "next-auth/react"; +import Link from "next/link"; +import { notFound, redirect } from "next/navigation"; import { SiGithub } from "react-icons/si"; -import { TbLoader2 } from "react-icons/tb"; +import { auth } from "@ctrlplane/auth"; import { Button } from "@ctrlplane/ui/button"; import { Card } from "@ctrlplane/ui/card"; -import { api } from "~/trpc/react"; +import { env } from "~/env"; +import { api } from "~/trpc/server"; +import { DeleteGithubUserButton } from "./DeleteGithubUserButton"; import { GithubConfigFileSync } from "./GithubConfigFile"; import { GithubConnectedOrgs } from "./GithubConnectedOrgs"; @@ -21,39 +21,28 @@ const githubAuthUrl = ( ) => `${githubUrl}/login/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${baseUrl}/api/github/${userId}/${workspaceSlug}&state=sLtHqpxQ6FiUtBWJ&scope=repo%2Cread%3Auser`; -export default function GitHubIntegrationPage({ +export default async function GitHubIntegrationPage({ params, }: { params: { workspaceSlug: string }; }) { const { workspaceSlug } = params; - const workspace = api.workspace.bySlug.useQuery(workspaceSlug); - const session = useSession(); - const router = useRouter(); - const baseUrl = api.runtime.baseUrl.useQuery(); - - const githubUrl = api.runtime.github.url.useQuery(); - const githubBotName = api.runtime.github.botName.useQuery(); - const githubBotClientId = api.runtime.github.clientId.useQuery(); - const isGithubConfigured = - githubUrl.data != null && - githubBotName.data != null && - githubBotClientId.data != null; - - const githubUser = api.github.user.byUserId.useQuery(session.data!.user.id, { - enabled: session.status === "authenticated", - }); + const workspace = await api.workspace.bySlug(workspaceSlug); + if (workspace == null) return notFound(); + const session = await auth(); + if (session == null) redirect("/login"); - const deleteGithubUser = api.github.user.delete.useMutation(); + const baseUrl = env.BASE_URL; - const configFiles = api.github.configFile.list.useQuery( - workspace.data?.id ?? "", - { enabled: workspace.data != null }, - ); + const githubUrl = env.GITHUB_URL; + const githubBotName = env.GITHUB_BOT_NAME; + const githubBotClientId = env.GITHUB_BOT_CLIENT_ID; + const isGithubConfigured = + githubUrl != null && githubBotName != null && githubBotClientId != null; - const loading = workspace.isLoading || githubUser.isLoading; + const githubUser = await api.github.user.byUserId(session.user.id); - const utils = api.useUtils(); + const configFiles = await api.github.configFile.list(workspace.id); return (
@@ -68,80 +57,54 @@ export default function GitHubIntegrationPage({
- {loading && ( -
- -
- )} - - {!loading && ( -
- -
-

- {githubUser.data != null - ? "Personal account connected" - : "Connect your personal account"} -

-

- {githubUser.data != null - ? "Your GitHub account is connected to Ctrlplane" - : "Connect your GitHub account to Ctrlplane to add Github organizations to your workspaces"} -

-
- {githubUser.data == null && ( - - )} - {githubUser.data != null && ( - - )} -
- - {isGithubConfigured && ( - +
+ +
+

+ {githubUser != null + ? "Personal account connected" + : "Connect your personal account"} +

+

+ {githubUser != null + ? "Your GitHub account is connected to Ctrlplane" + : "Connect your GitHub account to Ctrlplane to add Github organizations to your workspaces"} +

+
+ {githubUser == null && ( + + + )} - - -
- )} + {githubUser != null && ( + + )} + + + {isGithubConfigured && ( + + )} + + +
); } diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/layout.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/layout.tsx index 075237de..4cac65c5 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/layout.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/layout.tsx @@ -1,6 +1,4 @@ -"use client"; - -import { useRouter } from "next/navigation"; +import Link from "next/link"; import { TbArrowLeft } from "react-icons/tb"; import { Button } from "@ctrlplane/ui/button"; @@ -12,20 +10,16 @@ export default function IntegrationLayout({ children: React.ReactNode; params: { workspaceSlug: string }; }) { - const router = useRouter(); const { workspaceSlug } = params; return (
- + + + + {children}
diff --git a/apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx b/apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx index e9f0f1a8..e2eb1be6 100644 --- a/apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/systems/[systemSlug]/deployments/[deploymentSlug]/configure/job-agent/ConfigureJobAgentGithub.tsx @@ -29,7 +29,7 @@ export const ConfigureJobAgentGithub: React.FC<{ onChange: (v: Record) => void; }> = ({ value, jobAgent, onChange }) => { const repos = api.github.organizations.repos.list.useQuery({ - login: jobAgent.config.login, + owner: jobAgent.config.owner, installationId: jobAgent.config.installationId, }); @@ -40,7 +40,7 @@ export const ConfigureJobAgentGithub: React.FC<{ { installationId: jobAgent.config.installationId, repo: repo ?? "", - login: jobAgent.config.login, + owner: jobAgent.config.owner, }, { enabled: repo != null }, ); @@ -59,7 +59,7 @@ export const ConfigureJobAgentGithub: React.FC<{ onChange({ installationId: jobAgent.config.installationId, - login: jobAgent.config.login, + owner: jobAgent.config.owner, repo, workflowId, }); @@ -95,7 +95,7 @@ export const ConfigureJobAgentGithub: React.FC<{ - {repos.data?.data.map((repo) => ( + {repos.data?.map((repo) => ( { }, }); - const baseUrl = await api.runtime.baseUrl(); + const baseUrl = env.BASE_URL; const workspaceSlug = activeWorkspace.slug; return NextResponse.redirect( diff --git a/apps/webservice/src/app/api/workflow-invite-redirect/[workspaceSlug]/route.ts b/apps/webservice/src/app/api/workflow-invite-redirect/[workspaceSlug]/route.ts index c371307a..0963a422 100644 --- a/apps/webservice/src/app/api/workflow-invite-redirect/[workspaceSlug]/route.ts +++ b/apps/webservice/src/app/api/workflow-invite-redirect/[workspaceSlug]/route.ts @@ -5,7 +5,7 @@ import { eq, takeFirst } from "@ctrlplane/db"; import { db } from "@ctrlplane/db/client"; import { workspace, workspaceMember } from "@ctrlplane/db/schema"; -import { api } from "~/trpc/server"; +import { env } from "~/env"; export const GET = async ({ params, @@ -16,7 +16,7 @@ export const GET = async ({ const session = await auth(); if (session?.user == null) return NextResponse.redirect("/login"); - const baseUrl = await api.runtime.baseUrl(); + const baseUrl = env.BASE_URL; await db .transaction((db) => diff --git a/apps/webservice/src/env.ts b/apps/webservice/src/env.ts index d87122fb..9c51439c 100644 --- a/apps/webservice/src/env.ts +++ b/apps/webservice/src/env.ts @@ -16,10 +16,13 @@ export const env = createEnv({ * This way you can ensure the app isn't built with invalid env vars. */ server: { + GITHUB_URL: z.string().optional(), + GITHUB_BOT_NAME: z.string().optional(), GITHUB_BOT_CLIENT_ID: z.string().optional(), GITHUB_BOT_CLIENT_SECRET: z.string().optional(), GITHUB_BOT_APP_ID: z.string().optional(), GITHUB_BOT_PRIVATE_KEY: z.string().optional(), + BASE_URL: z.string(), }, /** diff --git a/packages/api/src/router/github/create-github-org.ts b/packages/api/src/router/github/create-github-org.ts index ebf326c8..4a721d28 100644 --- a/packages/api/src/router/github/create-github-org.ts +++ b/packages/api/src/router/github/create-github-org.ts @@ -9,7 +9,7 @@ import { Octokit } from "@octokit/rest"; import * as yaml from "js-yaml"; import { isPresent } from "ts-is-present"; -import { and, eq, inArray, takeFirst } from "@ctrlplane/db"; +import { and, eq, inArray, sql, takeFirst } from "@ctrlplane/db"; import { deployment, githubConfigFile, @@ -150,7 +150,15 @@ const processParsedConfigFiles = async ( ) .flat(); - await db.insert(deployment).values(deployments); + await db + .insert(deployment) + .values(deployments) + .onConflictDoUpdate({ + target: [deployment.systemId, deployment.slug], + set: { + githubConfigFileId: sql`excluded.github_config_file_id`, + }, + }); }; export const createNewGithubOrganization = async ( diff --git a/packages/api/src/router/github/github.ts b/packages/api/src/router/github/github.ts index 0ba8553e..3ac03c17 100644 --- a/packages/api/src/router/github/github.ts +++ b/packages/api/src/router/github/github.ts @@ -5,12 +5,14 @@ import _ from "lodash"; import { isPresent } from "ts-is-present"; import { z } from "zod"; -import { eq, takeFirstOrNull } from "@ctrlplane/db"; +import { and, eq, inArray, takeFirstOrNull } from "@ctrlplane/db"; import { + deployment, githubConfigFile, githubOrganization, githubOrganizationInsert, githubUser, + jobAgent, } from "@ctrlplane/db/schema"; import { env } from "../../config"; @@ -87,7 +89,7 @@ const userRouter = createTRPCRouter({ const reposRouter = createTRPCRouter({ list: protectedProcedure - .input(z.object({ installationId: z.number(), login: z.string() })) + .input(z.object({ installationId: z.number(), owner: z.string() })) .query(({ input }) => octokit?.apps .getInstallation({ @@ -100,13 +102,14 @@ const reposRouter = createTRPCRouter({ installationId: installation.id, })) as { token: string }; - return installationOctokit.repos.listForOrg({ - org: input.login, + const { data } = await installationOctokit.repos.listForOrg({ + org: input.owner, headers: { "X-GitHub-Api-Version": "2022-11-28", authorization: `Bearer ${installationToken.token}`, }, }); + return data; }), ), @@ -115,7 +118,7 @@ const reposRouter = createTRPCRouter({ .input( z.object({ installationId: z.number(), - login: z.string(), + owner: z.string(), repo: z.string(), }), ) @@ -130,8 +133,7 @@ const reposRouter = createTRPCRouter({ })) as { token: string }; return installationOctokit.actions.listRepoWorkflows({ - owner: input.login, - repo: input.repo, + ...input, headers: { "X-GitHub-Api-Version": "2022-11-28", authorization: `Bearer ${installationToken.token}`, @@ -230,18 +232,43 @@ export const githubRouter = createTRPCRouter({ ); }), - list: protectedProcedure - .input(z.string().uuid()) - .query(({ ctx, input }) => - ctx.db - .select() - .from(githubOrganization) - .leftJoin( - githubUser, - eq(githubOrganization.addedByUserId, githubUser.userId), - ) - .where(eq(githubOrganization.workspaceId, input)), - ), + list: protectedProcedure.input(z.string().uuid()).query(({ ctx, input }) => + ctx.db + .select() + .from(githubOrganization) + .leftJoin( + githubUser, + eq(githubOrganization.addedByUserId, githubUser.userId), + ) + .leftJoin( + githubConfigFile, + eq(githubConfigFile.organizationId, githubOrganization.id), + ) + .leftJoin( + deployment, + eq(deployment.githubConfigFileId, githubConfigFile.id), + ) + .where(eq(githubOrganization.workspaceId, input)) + .then((rows) => + _.chain(rows) + .groupBy("github_organization.id") + .map((v) => ({ + ...v[0]!.github_organization, + addedByUser: v[0]!.github_user, + configFiles: v + .map((v) => v.github_config_file) + .filter(isPresent) + .map((cf) => ({ + ...cf, + deployments: v + .map((v) => v.deployment) + .filter(isPresent) + .filter((d) => d.githubConfigFileId === cf.id), + })), + })) + .value(), + ), + ), create: protectedProcedure .input(githubOrganizationInsert) @@ -268,6 +295,55 @@ export const githubRouter = createTRPCRouter({ .where(eq(githubOrganization.id, input.id)), ), + delete: protectedProcedure + .input( + z.object({ id: z.string().uuid(), deleteDeployments: z.boolean() }), + ) + .mutation(({ ctx, input }) => + ctx.db.transaction(async (db) => { + const configFiles = await db + .select() + .from(githubConfigFile) + .where(eq(githubConfigFile.organizationId, input.id)); + + const deletedOrg = await db + .delete(githubOrganization) + .where(eq(githubOrganization.id, input.id)) + .returning() + .then(takeFirstOrNull); + + if (deletedOrg == null) + throw new TRPCError({ + code: "NOT_FOUND", + message: "Organization not found", + }); + + await db + .delete(jobAgent) + .where( + and( + eq(jobAgent.type, "github-app"), + eq(jobAgent.name, deletedOrg.organizationName), + eq(jobAgent.workspaceId, deletedOrg.workspaceId), + ), + ); + + if (input.deleteDeployments) + await db.delete(deployment).where( + inArray( + deployment.githubConfigFileId, + configFiles.map((c) => c.id), + ), + ); + + octokit?.apps.deleteInstallation({ + installation_id: deletedOrg.installationId, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + }); + }), + ), repos: reposRouter, }), }); diff --git a/packages/api/src/router/runtime.ts b/packages/api/src/router/runtime.ts index 55d16ee4..3428cc99 100644 --- a/packages/api/src/router/runtime.ts +++ b/packages/api/src/router/runtime.ts @@ -1,13 +1,6 @@ import { env } from "../config"; import { createTRPCRouter, protectedProcedure } from "../trpc"; -const githubRouter = createTRPCRouter({ - url: protectedProcedure.query(() => env.GITHUB_URL), - botName: protectedProcedure.query(() => env.GITHUB_BOT_NAME), - clientId: protectedProcedure.query(() => env.GITHUB_BOT_CLIENT_ID), -}); - export const runtimeRouter = createTRPCRouter({ baseUrl: protectedProcedure.query(() => env.BASE_URL), - github: githubRouter, }); diff --git a/packages/db/drizzle/0007_thick_proteus.sql b/packages/db/drizzle/0007_thick_proteus.sql new file mode 100644 index 00000000..2ce89957 --- /dev/null +++ b/packages/db/drizzle/0007_thick_proteus.sql @@ -0,0 +1,10 @@ +ALTER TABLE "deployment" DROP CONSTRAINT "deployment_github_config_file_id_github_config_file_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment" ADD CONSTRAINT "deployment_github_config_file_id_github_config_file_id_fk" FOREIGN KEY ("github_config_file_id") REFERENCES "public"."github_config_file"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "unique_installation_workspace" ON "github_organization" ("installation_id","workspace_id");--> statement-breakpoint +ALTER TABLE "github_organization" DROP COLUMN IF EXISTS "connected"; \ No newline at end of file diff --git a/packages/db/drizzle/0008_gigantic_kat_farrell.sql b/packages/db/drizzle/0008_gigantic_kat_farrell.sql new file mode 100644 index 00000000..ff5df111 --- /dev/null +++ b/packages/db/drizzle/0008_gigantic_kat_farrell.sql @@ -0,0 +1,7 @@ +ALTER TABLE "deployment" DROP CONSTRAINT "deployment_job_agent_id_job_agent_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment" ADD CONSTRAINT "deployment_job_agent_id_job_agent_id_fk" FOREIGN KEY ("job_agent_id") REFERENCES "public"."job_agent"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/packages/db/drizzle/meta/0007_snapshot.json b/packages/db/drizzle/meta/0007_snapshot.json new file mode 100644 index 00000000..f4c58c18 --- /dev/null +++ b/packages/db/drizzle/meta/0007_snapshot.json @@ -0,0 +1,2589 @@ +{ + "id": "48f66ca1-8f8a-4ee7-85ac-a45ed4ed0ccd", + "prevId": "20958308-7a35-45b3-bbfd-91b66127eb35", + "version": "6", + "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": "varchar(255)", + "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": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "active_workspace_id": { + "name": "active_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "null" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_key_index": { + "name": "deployment_variable_deployment_id_key_index", + "columns": ["deployment_id", "key"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_deployment_id_deployment_id_fk": { + "name": "deployment_variable_deployment_id_deployment_id_fk", + "tableFrom": "deployment_variable", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_id": { + "name": "variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_variable_id_value_index": { + "name": "deployment_variable_value_variable_id_value_index", + "columns": ["variable_id", "value"], + "isUnique": true + } + }, + "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": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target": { + "name": "deployment_variable_value_target", + "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 + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_target_variable_value_id_target_id_index": { + "name": "deployment_variable_value_target_variable_value_id_target_id_index", + "columns": ["variable_value_id", "target_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_variable_value_target_target_id_target_id_fk": { + "name": "deployment_variable_value_target_target_id_target_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target_filter": { + "name": "deployment_variable_value_target_filter", + "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 + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target_filter", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "github_config_file_id": { + "name": "github_config_file_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_system_id_slug_index": { + "name": "deployment_system_id_slug_index", + "columns": ["system_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_system_id_system_id_fk": { + "name": "deployment_system_id_system_id_fk", + "tableFrom": "deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_job_agent_id_job_agent_id_fk": { + "name": "deployment_job_agent_id_job_agent_id_fk", + "tableFrom": "deployment", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_github_config_file_id_github_config_file_id_fk": { + "name": "deployment_github_config_file_id_github_config_file_id_fk", + "tableFrom": "deployment", + "tableTo": "github_config_file", + "columnsFrom": ["github_config_file_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_meta_dependency": { + "name": "deployment_meta_dependency", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "depends_on_id": { + "name": "depends_on_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_meta_dependency_depends_on_id_deployment_id_index": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", + "columns": ["depends_on_id", "deployment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_meta_dependency_deployment_id_deployment_id_fk": { + "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_meta_dependency_depends_on_id_deployment_id_fk": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["depends_on_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment": { + "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 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_filter": { + "name": "target_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "environment_system_id_system_id_fk": { + "name": "environment_system_id_system_id_fk", + "tableFrom": "environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_id_environment_policy_id_fk", + "tableFrom": "environment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy": { + "name": "environment_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "approval_required": { + "name": "approval_required", + "type": "environment_policy_approval_requirement", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "success_status": { + "name": "success_status", + "type": "environment_policy_deployment_success_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "minimum_success": { + "name": "minimum_success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "concurrency_type": { + "name": "concurrency_type", + "type": "concurrency_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "concurrency_limit": { + "name": "concurrency_limit", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "duration": { + "name": "duration", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "evaluate_with": { + "name": "evaluate_with", + "type": "evaluation_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "evaluate": { + "name": "evaluate", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "release_sequencing": { + "name": "release_sequencing", + "type": "release_sequencing_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'cancel'" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_system_id_system_id_fk": { + "name": "environment_policy_system_id_system_id_fk", + "tableFrom": "environment_policy", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_approval": { + "name": "environment_policy_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "approval_status_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + } + }, + "indexes": { + "environment_policy_approval_policy_id_release_id_index": { + "name": "environment_policy_approval_policy_id_release_id_index", + "columns": ["policy_id", "release_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_approval_policy_id_environment_policy_id_fk": { + "name": "environment_policy_approval_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_approval_release_id_release_id_fk": { + "name": "environment_policy_approval_release_id_release_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_deployment": { + "name": "environment_policy_deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_policy_deployment_policy_id_environment_id_index": { + "name": "environment_policy_deployment_policy_id_environment_id_index", + "columns": ["policy_id", "environment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_deployment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_environment_id_environment_id_fk": { + "name": "environment_policy_deployment_environment_id_environment_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_release_window": { + "name": "environment_policy_release_window", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "recurrence": { + "name": "recurrence", + "type": "recurrence_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_release_window_policy_id_environment_policy_id_fk": { + "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_release_window", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_config_file": { + "name": "github_config_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "repository_name": { + "name": "repository_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "unique_organization_repository_path": { + "name": "unique_organization_repository_path", + "columns": ["organization_id", "repository_name", "path"], + "isUnique": true + } + }, + "foreignKeys": { + "github_config_file_organization_id_github_organization_id_fk": { + "name": "github_config_file_organization_id_github_organization_id_fk", + "tableFrom": "github_config_file", + "tableTo": "github_organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_config_file_workspace_id_workspace_id_fk": { + "name": "github_config_file_workspace_id_workspace_id_fk", + "tableFrom": "github_config_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_organization": { + "name": "github_organization", + "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 + }, + "organization_name": { + "name": "organization_name", + "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()" + }, + "branch": { + "name": "branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'main'" + } + }, + "indexes": { + "unique_installation_workspace": { + "name": "unique_installation_workspace", + "columns": ["installation_id", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "github_organization_added_by_user_id_user_id_fk": { + "name": "github_organization_added_by_user_id_user_id_fk", + "tableFrom": "github_organization", + "tableTo": "user", + "columnsFrom": ["added_by_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_organization_workspace_id_workspace_id_fk": { + "name": "github_organization_workspace_id_workspace_id_fk", + "tableFrom": "github_organization", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_user": { + "name": "github_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "github_user_id": { + "name": "github_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "github_user_user_id_user_id_fk": { + "name": "github_user_user_id_user_id_fk", + "tableFrom": "github_user", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target": { + "name": "target", + "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": "'{}'" + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "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 + } + }, + "indexes": { + "target_identifier_workspace_id_index": { + "name": "target_identifier_workspace_id_index", + "columns": ["identifier", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_id_target_provider_id_fk": { + "name": "target_provider_id_target_provider_id_fk", + "tableFrom": "target", + "tableTo": "target_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "target_workspace_id_workspace_id_fk": { + "name": "target_workspace_id_workspace_id_fk", + "tableFrom": "target", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "target_name_unique": { + "name": "target_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.target_schema": { + "name": "target_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": { + "target_schema_version_kind_workspace_id_index": { + "name": "target_schema_version_kind_workspace_id_index", + "columns": ["version", "kind", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_schema_workspace_id_workspace_id_fk": { + "name": "target_schema_workspace_id_workspace_id_fk", + "tableFrom": "target_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider": { + "name": "target_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": { + "target_provider_workspace_id_name_index": { + "name": "target_provider_workspace_id_name_index", + "columns": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_workspace_id_workspace_id_fk": { + "name": "target_provider_workspace_id_workspace_id_fk", + "tableFrom": "target_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider_google": { + "name": "target_provider_google", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_provider_id": { + "name": "target_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_ids": { + "name": "project_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "target_provider_google_target_provider_id_target_provider_id_fk": { + "name": "target_provider_google_target_provider_id_target_provider_id_fk", + "tableFrom": "target_provider_google", + "tableTo": "target_provider", + "columnsFrom": ["target_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release": { + "name": "release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_deployment_id_version_index": { + "name": "release_deployment_id_version_index", + "columns": ["deployment_id", "version"], + "isUnique": true + } + }, + "foreignKeys": { + "release_deployment_id_deployment_id_fk": { + "name": "release_deployment_id_deployment_id_fk", + "tableFrom": "release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release_dependency": { + "name": "release_dependency", + "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 + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_label_group_id": { + "name": "target_label_group_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rule_type": { + "name": "rule_type", + "type": "release_dependency_rule_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "rule": { + "name": "rule", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "release_dependency_release_id_deployment_id_target_label_group_id_index": { + "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", + "columns": ["release_id", "deployment_id", "target_label_group_id"], + "isUnique": true + } + }, + "foreignKeys": { + "release_dependency_release_id_release_id_fk": { + "name": "release_dependency_release_id_release_id_fk", + "tableFrom": "release_dependency", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_deployment_id_deployment_id_fk": { + "name": "release_dependency_deployment_id_deployment_id_fk", + "tableFrom": "release_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_target_label_group_id_target_label_group_id_fk": { + "name": "release_dependency_target_label_group_id_target_label_group_id_fk", + "tableFrom": "release_dependency", + "tableTo": "target_label_group", + "columnsFrom": ["target_label_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.system": { + "name": "system", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "system_workspace_id_slug_index": { + "name": "system_workspace_id_slug_index", + "columns": ["workspace_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook": { + "name": "runbook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": ["team_id", "user_id"], + "isUnique": true + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_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": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_config": { + "name": "job_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "type": { + "name": "type", + "type": "job_config_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "caused_by_id": { + "name": "caused_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_config_caused_by_id_user_id_fk": { + "name": "job_config_caused_by_id_user_id_fk", + "tableFrom": "job_config", + "tableTo": "user", + "columnsFrom": ["caused_by_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_release_id_release_id_fk": { + "name": "job_config_release_id_release_id_fk", + "tableFrom": "job_config", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_target_id_target_id_fk": { + "name": "job_config_target_id_target_id_fk", + "tableFrom": "job_config", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_environment_id_environment_id_fk": { + "name": "job_config_environment_id_environment_id_fk", + "tableFrom": "job_config", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_runbook_id_runbook_id_fk": { + "name": "job_config_runbook_id_runbook_id_fk", + "tableFrom": "job_config", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_execution": { + "name": "job_execution", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_config_id": { + "name": "job_config_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_run_id": { + "name": "external_run_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "job_execution_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "job_execution_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'policy_passing'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_execution_job_config_id_job_config_id_fk": { + "name": "job_execution_job_config_id_job_config_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_config", + "columnsFrom": ["job_config_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_execution_job_agent_id_job_agent_id_fk": { + "name": "job_execution_job_agent_id_job_agent_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "google_service_account_email": { + "name": "google_service_account_email", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.workspace_member": { + "name": "workspace_member", + "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 + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "workspace_member_workspace_id_user_id_index": { + "name": "workspace_member_workspace_id_user_id_index", + "columns": ["workspace_id", "user_id"], + "isUnique": true + } + }, + "foreignKeys": { + "workspace_member_workspace_id_workspace_id_fk": { + "name": "workspace_member_workspace_id_workspace_id_fk", + "tableFrom": "workspace_member", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_member_user_id_user_id_fk": { + "name": "workspace_member_user_id_user_id_fk", + "tableFrom": "workspace_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.value": { + "name": "value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "value_set_id": { + "name": "value_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "value_value_set_id_key_value_index": { + "name": "value_value_set_id_key_value_index", + "columns": ["value_set_id", "key", "value"], + "isUnique": true + } + }, + "foreignKeys": { + "value_value_set_id_value_set_id_fk": { + "name": "value_value_set_id_value_set_id_fk", + "tableFrom": "value", + "tableTo": "value_set", + "columnsFrom": ["value_set_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.value_set": { + "name": "value_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": { + "value_set_system_id_system_id_fk": { + "name": "value_set_system_id_system_id_fk", + "tableFrom": "value_set", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace_invite_link": { + "name": "workspace_invite_link", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_member_id": { + "name": "workspace_member_id", + "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_link_workspace_member_id_workspace_member_id_fk": { + "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", + "tableFrom": "workspace_invite_link", + "tableTo": "workspace_member", + "columnsFrom": ["workspace_member_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_link_token_unique": { + "name": "workspace_invite_link_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.target_label_group": { + "name": "target_label_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 + } + }, + "indexes": {}, + "foreignKeys": { + "target_label_group_workspace_id_workspace_id_fk": { + "name": "target_label_group_workspace_id_workspace_id_fk", + "tableFrom": "target_label_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook_variable": { + "name": "runbook_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "default_value": { + "name": "default_value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "public.environment_policy_approval_requirement": { + "name": "environment_policy_approval_requirement", + "schema": "public", + "values": ["manual", "automatic"] + }, + "public.approval_status_type": { + "name": "approval_status_type", + "schema": "public", + "values": ["pending", "approved", "rejected"] + }, + "public.concurrency_type": { + "name": "concurrency_type", + "schema": "public", + "values": ["all", "some"] + }, + "public.environment_policy_deployment_success_type": { + "name": "environment_policy_deployment_success_type", + "schema": "public", + "values": ["all", "some", "optional"] + }, + "public.evaluation_type": { + "name": "evaluation_type", + "schema": "public", + "values": ["semver", "regex", "none"] + }, + "public.recurrence_type": { + "name": "recurrence_type", + "schema": "public", + "values": ["hourly", "daily", "weekly", "monthly"] + }, + "public.release_sequencing_type": { + "name": "release_sequencing_type", + "schema": "public", + "values": ["wait", "cancel"] + }, + "public.release_dependency_rule_type": { + "name": "release_dependency_rule_type", + "schema": "public", + "values": ["regex", "semver"] + }, + "public.job_config_type": { + "name": "job_config_type", + "schema": "public", + "values": [ + "new_release", + "new_target", + "target_changed", + "api", + "redeploy", + "runbook" + ] + }, + "public.job_execution_reason": { + "name": "job_execution_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override" + ] + }, + "public.job_execution_status": { + "name": "job_execution_status", + "schema": "public", + "values": [ + "completed", + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found" + ] + } + }, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/0008_snapshot.json b/packages/db/drizzle/meta/0008_snapshot.json new file mode 100644 index 00000000..6aa1f4ab --- /dev/null +++ b/packages/db/drizzle/meta/0008_snapshot.json @@ -0,0 +1,2589 @@ +{ + "id": "71f85ffd-25fa-4154-9cc3-68ee755060cc", + "prevId": "48f66ca1-8f8a-4ee7-85ac-a45ed4ed0ccd", + "version": "6", + "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": "varchar(255)", + "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": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "active_workspace_id": { + "name": "active_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "null" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_key_index": { + "name": "deployment_variable_deployment_id_key_index", + "columns": ["deployment_id", "key"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_deployment_id_deployment_id_fk": { + "name": "deployment_variable_deployment_id_deployment_id_fk", + "tableFrom": "deployment_variable", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_id": { + "name": "variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_variable_id_value_index": { + "name": "deployment_variable_value_variable_id_value_index", + "columns": ["variable_id", "value"], + "isUnique": true + } + }, + "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": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target": { + "name": "deployment_variable_value_target", + "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 + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_target_variable_value_id_target_id_index": { + "name": "deployment_variable_value_target_variable_value_id_target_id_index", + "columns": ["variable_value_id", "target_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_variable_value_target_target_id_target_id_fk": { + "name": "deployment_variable_value_target_target_id_target_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target_filter": { + "name": "deployment_variable_value_target_filter", + "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 + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target_filter", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "github_config_file_id": { + "name": "github_config_file_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_system_id_slug_index": { + "name": "deployment_system_id_slug_index", + "columns": ["system_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_system_id_system_id_fk": { + "name": "deployment_system_id_system_id_fk", + "tableFrom": "deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_job_agent_id_job_agent_id_fk": { + "name": "deployment_job_agent_id_job_agent_id_fk", + "tableFrom": "deployment", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "deployment_github_config_file_id_github_config_file_id_fk": { + "name": "deployment_github_config_file_id_github_config_file_id_fk", + "tableFrom": "deployment", + "tableTo": "github_config_file", + "columnsFrom": ["github_config_file_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_meta_dependency": { + "name": "deployment_meta_dependency", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "depends_on_id": { + "name": "depends_on_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_meta_dependency_depends_on_id_deployment_id_index": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", + "columns": ["depends_on_id", "deployment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_meta_dependency_deployment_id_deployment_id_fk": { + "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_meta_dependency_depends_on_id_deployment_id_fk": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["depends_on_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment": { + "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 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_filter": { + "name": "target_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "environment_system_id_system_id_fk": { + "name": "environment_system_id_system_id_fk", + "tableFrom": "environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_id_environment_policy_id_fk", + "tableFrom": "environment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy": { + "name": "environment_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "approval_required": { + "name": "approval_required", + "type": "environment_policy_approval_requirement", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "success_status": { + "name": "success_status", + "type": "environment_policy_deployment_success_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "minimum_success": { + "name": "minimum_success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "concurrency_type": { + "name": "concurrency_type", + "type": "concurrency_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "concurrency_limit": { + "name": "concurrency_limit", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "duration": { + "name": "duration", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "evaluate_with": { + "name": "evaluate_with", + "type": "evaluation_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "evaluate": { + "name": "evaluate", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "release_sequencing": { + "name": "release_sequencing", + "type": "release_sequencing_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'cancel'" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_system_id_system_id_fk": { + "name": "environment_policy_system_id_system_id_fk", + "tableFrom": "environment_policy", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_approval": { + "name": "environment_policy_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "approval_status_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + } + }, + "indexes": { + "environment_policy_approval_policy_id_release_id_index": { + "name": "environment_policy_approval_policy_id_release_id_index", + "columns": ["policy_id", "release_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_approval_policy_id_environment_policy_id_fk": { + "name": "environment_policy_approval_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_approval_release_id_release_id_fk": { + "name": "environment_policy_approval_release_id_release_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_deployment": { + "name": "environment_policy_deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_policy_deployment_policy_id_environment_id_index": { + "name": "environment_policy_deployment_policy_id_environment_id_index", + "columns": ["policy_id", "environment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_deployment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_environment_id_environment_id_fk": { + "name": "environment_policy_deployment_environment_id_environment_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_release_window": { + "name": "environment_policy_release_window", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "recurrence": { + "name": "recurrence", + "type": "recurrence_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_release_window_policy_id_environment_policy_id_fk": { + "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_release_window", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_config_file": { + "name": "github_config_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "repository_name": { + "name": "repository_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "unique_organization_repository_path": { + "name": "unique_organization_repository_path", + "columns": ["organization_id", "repository_name", "path"], + "isUnique": true + } + }, + "foreignKeys": { + "github_config_file_organization_id_github_organization_id_fk": { + "name": "github_config_file_organization_id_github_organization_id_fk", + "tableFrom": "github_config_file", + "tableTo": "github_organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_config_file_workspace_id_workspace_id_fk": { + "name": "github_config_file_workspace_id_workspace_id_fk", + "tableFrom": "github_config_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_organization": { + "name": "github_organization", + "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 + }, + "organization_name": { + "name": "organization_name", + "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()" + }, + "branch": { + "name": "branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'main'" + } + }, + "indexes": { + "unique_installation_workspace": { + "name": "unique_installation_workspace", + "columns": ["installation_id", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "github_organization_added_by_user_id_user_id_fk": { + "name": "github_organization_added_by_user_id_user_id_fk", + "tableFrom": "github_organization", + "tableTo": "user", + "columnsFrom": ["added_by_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_organization_workspace_id_workspace_id_fk": { + "name": "github_organization_workspace_id_workspace_id_fk", + "tableFrom": "github_organization", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_user": { + "name": "github_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "github_user_id": { + "name": "github_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "github_user_user_id_user_id_fk": { + "name": "github_user_user_id_user_id_fk", + "tableFrom": "github_user", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target": { + "name": "target", + "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": "'{}'" + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "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 + } + }, + "indexes": { + "target_identifier_workspace_id_index": { + "name": "target_identifier_workspace_id_index", + "columns": ["identifier", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_id_target_provider_id_fk": { + "name": "target_provider_id_target_provider_id_fk", + "tableFrom": "target", + "tableTo": "target_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "target_workspace_id_workspace_id_fk": { + "name": "target_workspace_id_workspace_id_fk", + "tableFrom": "target", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "target_name_unique": { + "name": "target_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.target_schema": { + "name": "target_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": { + "target_schema_version_kind_workspace_id_index": { + "name": "target_schema_version_kind_workspace_id_index", + "columns": ["version", "kind", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_schema_workspace_id_workspace_id_fk": { + "name": "target_schema_workspace_id_workspace_id_fk", + "tableFrom": "target_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider": { + "name": "target_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": { + "target_provider_workspace_id_name_index": { + "name": "target_provider_workspace_id_name_index", + "columns": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_workspace_id_workspace_id_fk": { + "name": "target_provider_workspace_id_workspace_id_fk", + "tableFrom": "target_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider_google": { + "name": "target_provider_google", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_provider_id": { + "name": "target_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_ids": { + "name": "project_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "target_provider_google_target_provider_id_target_provider_id_fk": { + "name": "target_provider_google_target_provider_id_target_provider_id_fk", + "tableFrom": "target_provider_google", + "tableTo": "target_provider", + "columnsFrom": ["target_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release": { + "name": "release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_deployment_id_version_index": { + "name": "release_deployment_id_version_index", + "columns": ["deployment_id", "version"], + "isUnique": true + } + }, + "foreignKeys": { + "release_deployment_id_deployment_id_fk": { + "name": "release_deployment_id_deployment_id_fk", + "tableFrom": "release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release_dependency": { + "name": "release_dependency", + "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 + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_label_group_id": { + "name": "target_label_group_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rule_type": { + "name": "rule_type", + "type": "release_dependency_rule_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "rule": { + "name": "rule", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "release_dependency_release_id_deployment_id_target_label_group_id_index": { + "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", + "columns": ["release_id", "deployment_id", "target_label_group_id"], + "isUnique": true + } + }, + "foreignKeys": { + "release_dependency_release_id_release_id_fk": { + "name": "release_dependency_release_id_release_id_fk", + "tableFrom": "release_dependency", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_deployment_id_deployment_id_fk": { + "name": "release_dependency_deployment_id_deployment_id_fk", + "tableFrom": "release_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_target_label_group_id_target_label_group_id_fk": { + "name": "release_dependency_target_label_group_id_target_label_group_id_fk", + "tableFrom": "release_dependency", + "tableTo": "target_label_group", + "columnsFrom": ["target_label_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.system": { + "name": "system", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "system_workspace_id_slug_index": { + "name": "system_workspace_id_slug_index", + "columns": ["workspace_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook": { + "name": "runbook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": ["team_id", "user_id"], + "isUnique": true + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_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": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_config": { + "name": "job_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "type": { + "name": "type", + "type": "job_config_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "caused_by_id": { + "name": "caused_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_config_caused_by_id_user_id_fk": { + "name": "job_config_caused_by_id_user_id_fk", + "tableFrom": "job_config", + "tableTo": "user", + "columnsFrom": ["caused_by_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_release_id_release_id_fk": { + "name": "job_config_release_id_release_id_fk", + "tableFrom": "job_config", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_target_id_target_id_fk": { + "name": "job_config_target_id_target_id_fk", + "tableFrom": "job_config", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_environment_id_environment_id_fk": { + "name": "job_config_environment_id_environment_id_fk", + "tableFrom": "job_config", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_runbook_id_runbook_id_fk": { + "name": "job_config_runbook_id_runbook_id_fk", + "tableFrom": "job_config", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_execution": { + "name": "job_execution", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_config_id": { + "name": "job_config_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_run_id": { + "name": "external_run_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "job_execution_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "job_execution_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'policy_passing'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_execution_job_config_id_job_config_id_fk": { + "name": "job_execution_job_config_id_job_config_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_config", + "columnsFrom": ["job_config_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_execution_job_agent_id_job_agent_id_fk": { + "name": "job_execution_job_agent_id_job_agent_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "google_service_account_email": { + "name": "google_service_account_email", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.workspace_member": { + "name": "workspace_member", + "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 + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "workspace_member_workspace_id_user_id_index": { + "name": "workspace_member_workspace_id_user_id_index", + "columns": ["workspace_id", "user_id"], + "isUnique": true + } + }, + "foreignKeys": { + "workspace_member_workspace_id_workspace_id_fk": { + "name": "workspace_member_workspace_id_workspace_id_fk", + "tableFrom": "workspace_member", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_member_user_id_user_id_fk": { + "name": "workspace_member_user_id_user_id_fk", + "tableFrom": "workspace_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.value": { + "name": "value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "value_set_id": { + "name": "value_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "value_value_set_id_key_value_index": { + "name": "value_value_set_id_key_value_index", + "columns": ["value_set_id", "key", "value"], + "isUnique": true + } + }, + "foreignKeys": { + "value_value_set_id_value_set_id_fk": { + "name": "value_value_set_id_value_set_id_fk", + "tableFrom": "value", + "tableTo": "value_set", + "columnsFrom": ["value_set_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.value_set": { + "name": "value_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": { + "value_set_system_id_system_id_fk": { + "name": "value_set_system_id_system_id_fk", + "tableFrom": "value_set", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace_invite_link": { + "name": "workspace_invite_link", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_member_id": { + "name": "workspace_member_id", + "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_link_workspace_member_id_workspace_member_id_fk": { + "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", + "tableFrom": "workspace_invite_link", + "tableTo": "workspace_member", + "columnsFrom": ["workspace_member_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_link_token_unique": { + "name": "workspace_invite_link_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.target_label_group": { + "name": "target_label_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 + } + }, + "indexes": {}, + "foreignKeys": { + "target_label_group_workspace_id_workspace_id_fk": { + "name": "target_label_group_workspace_id_workspace_id_fk", + "tableFrom": "target_label_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook_variable": { + "name": "runbook_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "default_value": { + "name": "default_value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": { + "public.environment_policy_approval_requirement": { + "name": "environment_policy_approval_requirement", + "schema": "public", + "values": ["manual", "automatic"] + }, + "public.approval_status_type": { + "name": "approval_status_type", + "schema": "public", + "values": ["pending", "approved", "rejected"] + }, + "public.concurrency_type": { + "name": "concurrency_type", + "schema": "public", + "values": ["all", "some"] + }, + "public.environment_policy_deployment_success_type": { + "name": "environment_policy_deployment_success_type", + "schema": "public", + "values": ["all", "some", "optional"] + }, + "public.evaluation_type": { + "name": "evaluation_type", + "schema": "public", + "values": ["semver", "regex", "none"] + }, + "public.recurrence_type": { + "name": "recurrence_type", + "schema": "public", + "values": ["hourly", "daily", "weekly", "monthly"] + }, + "public.release_sequencing_type": { + "name": "release_sequencing_type", + "schema": "public", + "values": ["wait", "cancel"] + }, + "public.release_dependency_rule_type": { + "name": "release_dependency_rule_type", + "schema": "public", + "values": ["regex", "semver"] + }, + "public.job_config_type": { + "name": "job_config_type", + "schema": "public", + "values": [ + "new_release", + "new_target", + "target_changed", + "api", + "redeploy", + "runbook" + ] + }, + "public.job_execution_reason": { + "name": "job_execution_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override" + ] + }, + "public.job_execution_status": { + "name": "job_execution_status", + "schema": "public", + "values": [ + "completed", + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found" + ] + } + }, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 8eb99f73..4817bb6e 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -50,6 +50,20 @@ "when": 1725482158482, "tag": "0006_youthful_kitty_pryde", "breakpoints": true + }, + { + "idx": 7, + "version": "6", + "when": 1725667085444, + "tag": "0007_thick_proteus", + "breakpoints": true + }, + { + "idx": 8, + "version": "6", + "when": 1725670707089, + "tag": "0008_gigantic_kat_farrell", + "breakpoints": true } ] } diff --git a/packages/db/src/schema/deployment.ts b/packages/db/src/schema/deployment.ts index 40c9dd19..a5108129 100644 --- a/packages/db/src/schema/deployment.ts +++ b/packages/db/src/schema/deployment.ts @@ -19,14 +19,16 @@ export const deployment = pgTable( systemId: uuid("system_id") .notNull() .references(() => system.id), - jobAgentId: uuid("job_agent_id").references(() => jobAgent.id), + jobAgentId: uuid("job_agent_id").references(() => jobAgent.id, { + onDelete: "set null", + }), jobAgentConfig: jsonb("job_agent_config") .default("{}") .$type>() .notNull(), githubConfigFileId: uuid("github_config_file_id").references( () => githubConfigFile.id, - { onDelete: "cascade" }, + { onDelete: "set null" }, ), }, (t) => ({ uniq: uniqueIndex().on(t.systemId, t.slug) }), diff --git a/packages/db/src/schema/github.ts b/packages/db/src/schema/github.ts index f09931ed..7f63b637 100644 --- a/packages/db/src/schema/github.ts +++ b/packages/db/src/schema/github.ts @@ -1,6 +1,5 @@ import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; import { - boolean, integer, pgTable, text, @@ -24,23 +23,31 @@ export const githubUser = pgTable("github_user", { export type GithubUser = InferSelectModel; -export const githubOrganization = pgTable("github_organization", { - id: uuid("id").primaryKey().defaultRandom(), - installationId: integer("installation_id").notNull(), - organizationName: text("organization_name").notNull(), - addedByUserId: uuid("added_by_user_id") - .notNull() - .references(() => user.id, { onDelete: "cascade" }), - workspaceId: uuid("workspace_id") - .notNull() - .references(() => workspace.id, { onDelete: "cascade" }), - avatarUrl: text("avatar_url"), - createdAt: timestamp("created_at", { withTimezone: true }) - .notNull() - .defaultNow(), - connected: boolean("connected").notNull().default(true), - branch: text("branch").notNull().default("main"), -}); +export const githubOrganization = pgTable( + "github_organization", + { + id: uuid("id").primaryKey().defaultRandom(), + installationId: integer("installation_id").notNull(), + organizationName: text("organization_name").notNull(), + addedByUserId: uuid("added_by_user_id") + .notNull() + .references(() => user.id, { onDelete: "cascade" }), + workspaceId: uuid("workspace_id") + .notNull() + .references(() => workspace.id, { onDelete: "cascade" }), + avatarUrl: text("avatar_url"), + createdAt: timestamp("created_at", { withTimezone: true }) + .notNull() + .defaultNow(), + branch: text("branch").notNull().default("main"), + }, + (t) => ({ + unique: uniqueIndex("unique_installation_workspace").on( + t.installationId, + t.workspaceId, + ), + }), +); export type GithubOrganization = InferSelectModel; export type GithubOrganizationInsert = InferInsertModel< From 74c10d71fa1fe84e00d7177d3d904dc826132490 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Sat, 7 Sep 2024 19:51:03 -0700 Subject: [PATCH 06/21] more stuff --- .../integrations/google/GoogleDialog.tsx | 13 +- .../google/UpdateGoogleProviderDialog.tsx | 13 +- .../[workspaceSlug]/_components/Callout.tsx | 18 ++ .../github/GithubAddOrgDialog.tsx | 221 ++++++------------ .../github/GithubConnectedOrgs.tsx | 52 +++-- .../SelectPreconnectedOrgDialogContent.tsx | 135 +++++++++++ .../(integration)/github/page.tsx | 1 - packages/api/src/router/github/github.ts | 7 - 8 files changed, 274 insertions(+), 186 deletions(-) create mode 100644 apps/webservice/src/app/[workspaceSlug]/_components/Callout.tsx create mode 100644 apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/SelectPreconnectedOrgDialogContent.tsx diff --git a/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/GoogleDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/GoogleDialog.tsx index f880b5ec..0ec7c3b6 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/GoogleDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/GoogleDialog.tsx @@ -5,7 +5,7 @@ import Link from "next/link"; import { useParams, useRouter } from "next/navigation"; import { zodResolver } from "@hookform/resolvers/zod"; import { useFieldArray, useForm } from "react-hook-form"; -import { TbBulb, TbCheck, TbCopy } from "react-icons/tb"; +import { TbCheck, TbCopy } from "react-icons/tb"; import { useCopyToClipboard } from "react-use"; import { z } from "zod"; @@ -32,6 +32,7 @@ import { Input } from "@ctrlplane/ui/input"; import { Label } from "@ctrlplane/ui/label"; import { api } from "~/trpc/react"; +import { Callout } from "../../../../_components/Callout"; export const createGoogleSchema = z.object({ name: z.string(), @@ -91,12 +92,8 @@ export const GoogleDialog: React.FC<{ children: React.ReactNode }> = ({ from google. -
- - + + To use the Google provider, you will need to invite our service account to your project and configure the necessary permissions. Read more{" "} @@ -109,7 +106,7 @@ export const GoogleDialog: React.FC<{ children: React.ReactNode }> = ({ . -
+
diff --git a/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx index 8f75c4eb..85302101 100644 --- a/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/(targets)/target-providers/integrations/google/UpdateGoogleProviderDialog.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import Link from "next/link"; import { useParams } from "next/navigation"; -import { TbBulb, TbCheck, TbCopy, TbX } from "react-icons/tb"; +import { TbCheck, TbCopy, TbX } from "react-icons/tb"; import { useCopyToClipboard } from "react-use"; import { cn } from "@ctrlplane/ui"; @@ -31,6 +31,7 @@ import { Input } from "@ctrlplane/ui/input"; import { Label } from "@ctrlplane/ui/label"; import { api } from "~/trpc/react"; +import { Callout } from "../../../../_components/Callout"; import { createGoogleSchema } from "./GoogleDialog"; export const UpdateGoogleProviderDialog: React.FC<{ @@ -101,12 +102,8 @@ export const UpdateGoogleProviderDialog: React.FC<{ from google. -
- - + + To use the Google provider, you will need to invite our service account to your project and configure the necessary permissions. Read more{" "} @@ -119,7 +116,7 @@ export const UpdateGoogleProviderDialog: React.FC<{ . -
+
diff --git a/apps/webservice/src/app/[workspaceSlug]/_components/Callout.tsx b/apps/webservice/src/app/[workspaceSlug]/_components/Callout.tsx new file mode 100644 index 00000000..64995366 --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/_components/Callout.tsx @@ -0,0 +1,18 @@ +import { TbBulb } from "react-icons/tb"; + +import { cn } from "@ctrlplane/ui"; + +export const Callout: React.FC<{ + children: React.ReactNode; + className?: string; +}> = ({ children, className }) => ( +
+ + {children} +
+); diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx index d20aba22..51a05dfe 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx @@ -1,19 +1,10 @@ "use client"; +import type { GithubUser } from "@ctrlplane/db/schema"; import { useState } from "react"; import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { TbBulb } from "react-icons/tb"; -import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; import { Button } from "@ctrlplane/ui/button"; -import { - Command, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from "@ctrlplane/ui/command"; import { Dialog, DialogContent, @@ -23,16 +14,13 @@ import { DialogTitle, DialogTrigger, } from "@ctrlplane/ui/dialog"; -import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover"; -import { Separator } from "@ctrlplane/ui/separator"; import { api } from "~/trpc/react"; +import { Callout } from "../../../../../../_components/Callout"; +import { SelectPreconnectedOrgDialogContent } from "./SelectPreconnectedOrgDialogContent"; type GithubAddOrgDialogProps = { - githubUser?: { - githubUserId: number; - userId: string; - }; + githubUser: GithubUser; children: React.ReactNode; githubConfig: { url: string; @@ -40,7 +28,6 @@ type GithubAddOrgDialogProps = { clientId: string; }; workspaceId: string; - workspaceSlug: string; }; export const GithubAddOrgDialog: React.FC = ({ @@ -49,12 +36,9 @@ export const GithubAddOrgDialog: React.FC = ({ githubConfig, workspaceId, }) => { - const [open, setOpen] = useState(false); - const [popoverOpen, setPopoverOpen] = useState(false); const githubOrgs = api.github.organizations.byGithubUserId.useQuery( - githubUser?.githubUserId ?? 0, + githubUser.githubUserId, ); - const router = useRouter(); const githubOrgsInstalled = api.github.organizations.list.useQuery(workspaceId); @@ -66,145 +50,90 @@ export const GithubAddOrgDialog: React.FC = ({ ), ) ?? []; - const githubOrgCreate = api.github.organizations.create.useMutation(); - - const [image, setImage] = useState(null); - const [value, setValue] = useState(null); - - const handlePreconnectedOrgSave = () => { - if (value == null) return; - const org = validOrgsToAdd.find((o) => o.login === value); - if (org == null) return; - - githubOrgCreate - .mutateAsync({ - installationId: org.installationId, - workspaceId, - organizationName: org.login, - addedByUserId: githubUser?.userId ?? "", - avatarUrl: org.avatar_url, - }) - .then(() => router.refresh()); - }; + const [dialogStep, setDialogStep] = useState<"choose-org" | "pre-connected">( + "choose-org", + ); + const [open, setOpen] = useState(false); return ( {children} - -
- - Connect a new Organization - - Install the Github app on the organization to connect it to your - workspace. - - - - - - -
- - {validOrgsToAdd.length > 0 && ( + + {dialogStep === "choose-org" && ( <> - -
- - - Select from pre-connected organizations - + + Connect a new Organization + {validOrgsToAdd.length === 0 && ( -
- - - These organizations already have the Github application - installed, so you can simply add them to your workspace to - unlock agent configuration and config file syncing. Read - more{" "} - - here - - . - -
+ Install the ctrlplane Github app on an organization to connect + it to your workspace.
-
- - - + )} +
+ + {validOrgsToAdd.length > 0 && ( + + You have two options for connecting an organization: +
    +
  1. + Connect a new organization: Install the + ctrlplane Github app on an organization to connect it to + your workspace. +
  2. +
  3. + Select a pre-connected organization: Choose + an organization that already has the ctrlplane Github app + installed. +
  4. +
+ + Read more{" "} + + here + + . + +
+ )} + + + + + + + {validOrgsToAdd.length > 0 && ( +
- - - - - - - {validOrgsToAdd.map(({ id, login, avatar_url }) => ( - { - setValue(currentValue); - setImage(avatar_url); - setPopoverOpen(false); - }} - className="w-full cursor-pointer" - > -
- - - - {login.slice(0, 2)} - - - {login} -
-
- ))} -
-
-
-
- -
+
+ )} + )} - - - + {dialogStep === "pre-connected" && ( + setDialogStep("choose-org")} + onSave={() => { + setOpen(false); + setDialogStep("choose-org"); + }} + /> + )}
); diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx index 19f378ba..9d3a75be 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx @@ -11,6 +11,12 @@ import { CardTitle, } from "@ctrlplane/ui/card"; import { Separator } from "@ctrlplane/ui/separator"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@ctrlplane/ui/tooltip"; import { api } from "~/trpc/server"; import { GithubAddOrgDialog } from "./GithubAddOrgDialog"; @@ -18,8 +24,7 @@ import { OrgActionDropdown } from "./OrgActionDropdown"; type GithubConnectedOrgsProps = { githubUser?: GithubUser | null; - workspaceSlug?: string; - workspaceId?: string; + workspaceId: string; loading: boolean; githubConfig: { url: string; @@ -30,13 +35,10 @@ type GithubConnectedOrgsProps = { export const GithubConnectedOrgs: React.FC = async ({ githubUser, - workspaceSlug, workspaceId, githubConfig, }) => { - const githubOrgsInstalled = await api.github.organizations.list( - workspaceId ?? "", - ); + const githubOrgsInstalled = await api.github.organizations.list(workspaceId); return ( @@ -50,16 +52,34 @@ export const GithubConnectedOrgs: React.FC = async ({ organizations
- - - + {githubUser != null ? ( + + + + ) : ( + + + + + + +

Connect your Github account to add organizations

+
+
+
+ )} {githubOrgsInstalled.length > 0 && ( diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/SelectPreconnectedOrgDialogContent.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/SelectPreconnectedOrgDialogContent.tsx new file mode 100644 index 00000000..79123abf --- /dev/null +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/SelectPreconnectedOrgDialogContent.tsx @@ -0,0 +1,135 @@ +import type { GithubUser } from "@ctrlplane/db/schema"; +import type { RestEndpointMethodTypes } from "@octokit/rest"; +import { useState } from "react"; +import { useRouter } from "next/navigation"; + +import { Avatar, AvatarFallback, AvatarImage } from "@ctrlplane/ui/avatar"; +import { Button } from "@ctrlplane/ui/button"; +import { + Command, + CommandGroup, + CommandInput, + CommandItem, + CommandList, +} from "@ctrlplane/ui/command"; +import { DialogFooter, DialogHeader, DialogTitle } from "@ctrlplane/ui/dialog"; +import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover"; + +import { api } from "~/trpc/react"; + +type GithubOrg = RestEndpointMethodTypes["orgs"]["get"]["response"]["data"] & { + installationId: number; +}; + +type PreconnectedOrgsComboboxProps = { + githubOrgs: GithubOrg[]; + githubUser: GithubUser; + workspaceId: string; + onNavigateBack: () => void; + onSave: () => void; +}; + +export const SelectPreconnectedOrgDialogContent: React.FC< + PreconnectedOrgsComboboxProps +> = ({ githubOrgs, githubUser, workspaceId, onNavigateBack, onSave }) => { + const [open, setOpen] = useState(false); + const [value, setValue] = useState(null); + const [image, setImage] = useState(null); + const router = useRouter(); + + const githubOrgCreate = api.github.organizations.create.useMutation(); + + const handleSave = () => { + if (value == null) return; + const org = githubOrgs.find((o) => o.login === value); + if (org == null) return; + + githubOrgCreate + .mutateAsync({ + installationId: org.installationId, + workspaceId, + organizationName: org.login, + addedByUserId: githubUser.userId, + avatarUrl: org.avatar_url, + }) + .then(() => { + onSave(); + router.refresh(); + }); + }; + + return ( + <> + + Select a pre-connected organization + + + + + + + + + + + {githubOrgs.map(({ id, login, avatar_url }) => ( + { + setValue(currentValue); + setImage(avatar_url); + setOpen(false); + }} + className="w-full cursor-pointer" + > +
+ + + {login.slice(0, 2)} + + {login} +
+
+ ))} +
+
+
+
+
+ + + +
+ +
+
+ + ); +}; diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx index 9c2adf51..3aa7b79b 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/page.tsx @@ -93,7 +93,6 @@ export default async function GitHubIntegrationPage({ c.id), ), ); - - octokit?.apps.deleteInstallation({ - installation_id: deletedOrg.installationId, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - }, - }); }), ), repos: reposRouter, From 88058ad86f207eede6b8f8bf1df0f0f61d0a5da8 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Sat, 7 Sep 2024 19:55:06 -0700 Subject: [PATCH 07/21] remove drizzle files --- packages/db/drizzle/0007_thick_proteus.sql | 10 - .../db/drizzle/0008_gigantic_kat_farrell.sql | 7 - packages/db/drizzle/meta/0000_snapshot.json | 2515 ---------------- packages/db/drizzle/meta/0001_snapshot.json | 2508 ---------------- packages/db/drizzle/meta/0002_snapshot.json | 2510 ---------------- packages/db/drizzle/meta/0003_snapshot.json | 2516 ---------------- packages/db/drizzle/meta/0004_snapshot.json | 2533 ---------------- packages/db/drizzle/meta/0005_snapshot.json | 2590 ----------------- packages/db/drizzle/meta/0006_snapshot.json | 2590 ----------------- packages/db/drizzle/meta/0007_snapshot.json | 2589 ---------------- packages/db/drizzle/meta/0008_snapshot.json | 2589 ---------------- packages/db/drizzle/meta/_journal.json | 69 - 12 files changed, 23026 deletions(-) delete mode 100644 packages/db/drizzle/0007_thick_proteus.sql delete mode 100644 packages/db/drizzle/0008_gigantic_kat_farrell.sql delete mode 100644 packages/db/drizzle/meta/0000_snapshot.json delete mode 100644 packages/db/drizzle/meta/0001_snapshot.json delete mode 100644 packages/db/drizzle/meta/0002_snapshot.json delete mode 100644 packages/db/drizzle/meta/0003_snapshot.json delete mode 100644 packages/db/drizzle/meta/0004_snapshot.json delete mode 100644 packages/db/drizzle/meta/0005_snapshot.json delete mode 100644 packages/db/drizzle/meta/0006_snapshot.json delete mode 100644 packages/db/drizzle/meta/0007_snapshot.json delete mode 100644 packages/db/drizzle/meta/0008_snapshot.json delete mode 100644 packages/db/drizzle/meta/_journal.json diff --git a/packages/db/drizzle/0007_thick_proteus.sql b/packages/db/drizzle/0007_thick_proteus.sql deleted file mode 100644 index 2ce89957..00000000 --- a/packages/db/drizzle/0007_thick_proteus.sql +++ /dev/null @@ -1,10 +0,0 @@ -ALTER TABLE "deployment" DROP CONSTRAINT "deployment_github_config_file_id_github_config_file_id_fk"; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "deployment" ADD CONSTRAINT "deployment_github_config_file_id_github_config_file_id_fk" FOREIGN KEY ("github_config_file_id") REFERENCES "public"."github_config_file"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; ---> statement-breakpoint -CREATE UNIQUE INDEX IF NOT EXISTS "unique_installation_workspace" ON "github_organization" ("installation_id","workspace_id");--> statement-breakpoint -ALTER TABLE "github_organization" DROP COLUMN IF EXISTS "connected"; \ No newline at end of file diff --git a/packages/db/drizzle/0008_gigantic_kat_farrell.sql b/packages/db/drizzle/0008_gigantic_kat_farrell.sql deleted file mode 100644 index ff5df111..00000000 --- a/packages/db/drizzle/0008_gigantic_kat_farrell.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE "deployment" DROP CONSTRAINT "deployment_job_agent_id_job_agent_id_fk"; ---> statement-breakpoint -DO $$ BEGIN - ALTER TABLE "deployment" ADD CONSTRAINT "deployment_job_agent_id_job_agent_id_fk" FOREIGN KEY ("job_agent_id") REFERENCES "public"."job_agent"("id") ON DELETE set null ON UPDATE no action; -EXCEPTION - WHEN duplicate_object THEN null; -END $$; diff --git a/packages/db/drizzle/meta/0000_snapshot.json b/packages/db/drizzle/meta/0000_snapshot.json deleted file mode 100644 index d7f7add9..00000000 --- a/packages/db/drizzle/meta/0000_snapshot.json +++ /dev/null @@ -1,2515 +0,0 @@ -{ - "id": "963facaf-7c0b-418d-a921-3d8736b1cfb2", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "uuid", - "primaryKey": false, - "notNull": true, - "default": "gen_random_uuid()" - } - }, - "indexes": {}, - "foreignKeys": { - "workspace_invite_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0001_snapshot.json b/packages/db/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 0bee908d..00000000 --- a/packages/db/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,2508 +0,0 @@ -{ - "id": "0f4c03e8-ef61-43b0-a394-0bebe96c52d6", - "prevId": "963facaf-7c0b-418d-a921-3d8736b1cfb2", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "uuid", - "primaryKey": false, - "notNull": true, - "default": "gen_random_uuid()" - } - }, - "indexes": {}, - "foreignKeys": { - "workspace_invite_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0002_snapshot.json b/packages/db/drizzle/meta/0002_snapshot.json deleted file mode 100644 index e4ae55ad..00000000 --- a/packages/db/drizzle/meta/0002_snapshot.json +++ /dev/null @@ -1,2510 +0,0 @@ -{ - "id": "675ebac0-2b64-40e8-ae50-f3f10d0bd7bf", - "prevId": "0f4c03e8-ef61-43b0-a394-0bebe96c52d6", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "uuid", - "primaryKey": false, - "notNull": true, - "default": "gen_random_uuid()" - } - }, - "indexes": {}, - "foreignKeys": { - "workspace_invite_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0003_snapshot.json b/packages/db/drizzle/meta/0003_snapshot.json deleted file mode 100644 index b2f09000..00000000 --- a/packages/db/drizzle/meta/0003_snapshot.json +++ /dev/null @@ -1,2516 +0,0 @@ -{ - "id": "e8206f8d-b2d6-4f41-ab20-7a492ef5a4f0", - "prevId": "675ebac0-2b64-40e8-ae50-f3f10d0bd7bf", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0004_snapshot.json b/packages/db/drizzle/meta/0004_snapshot.json deleted file mode 100644 index 6c9f72de..00000000 --- a/packages/db/drizzle/meta/0004_snapshot.json +++ /dev/null @@ -1,2533 +0,0 @@ -{ - "id": "ceb25c02-60ee-4c87-8cfe-e2540ddf1812", - "prevId": "e8206f8d-b2d6-4f41-ab20-7a492ef5a4f0", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "active_workspace_id": { - "name": "active_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false, - "default": "null" - } - }, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0005_snapshot.json b/packages/db/drizzle/meta/0005_snapshot.json deleted file mode 100644 index cc12f9dd..00000000 --- a/packages/db/drizzle/meta/0005_snapshot.json +++ /dev/null @@ -1,2590 +0,0 @@ -{ - "id": "c7e691ad-b60b-4452-a967-28024d710694", - "prevId": "ceb25c02-60ee-4c87-8cfe-e2540ddf1812", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "active_workspace_id": { - "name": "active_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false, - "default": "null" - } - }, - "indexes": {}, - "foreignKeys": { - "user_active_workspace_id_workspace_id_fk": { - "name": "user_active_workspace_id_workspace_id_fk", - "tableFrom": "user", - "tableTo": "workspace", - "columnsFrom": ["active_workspace_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user_api_key": { - "name": "user_api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "key_preview": { - "name": "key_preview", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "user_api_key_user_id_user_id_fk": { - "name": "user_api_key_user_id_user_id_fk", - "tableFrom": "user_api_key", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0006_snapshot.json b/packages/db/drizzle/meta/0006_snapshot.json deleted file mode 100644 index 4dfded5a..00000000 --- a/packages/db/drizzle/meta/0006_snapshot.json +++ /dev/null @@ -1,2590 +0,0 @@ -{ - "id": "20958308-7a35-45b3-bbfd-91b66127eb35", - "prevId": "c7e691ad-b60b-4452-a967-28024d710694", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "active_workspace_id": { - "name": "active_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false, - "default": "null" - } - }, - "indexes": {}, - "foreignKeys": { - "user_active_workspace_id_workspace_id_fk": { - "name": "user_active_workspace_id_workspace_id_fk", - "tableFrom": "user", - "tableTo": "workspace", - "columnsFrom": ["active_workspace_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user_api_key": { - "name": "user_api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "key_preview": { - "name": "key_preview", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "user_api_key_user_id_user_id_fk": { - "name": "user_api_key_user_id_user_id_fk", - "tableFrom": "user_api_key", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "connected": { - "name": "connected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": {}, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0007_snapshot.json b/packages/db/drizzle/meta/0007_snapshot.json deleted file mode 100644 index f4c58c18..00000000 --- a/packages/db/drizzle/meta/0007_snapshot.json +++ /dev/null @@ -1,2589 +0,0 @@ -{ - "id": "48f66ca1-8f8a-4ee7-85ac-a45ed4ed0ccd", - "prevId": "20958308-7a35-45b3-bbfd-91b66127eb35", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "active_workspace_id": { - "name": "active_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false, - "default": "null" - } - }, - "indexes": {}, - "foreignKeys": { - "user_active_workspace_id_workspace_id_fk": { - "name": "user_active_workspace_id_workspace_id_fk", - "tableFrom": "user", - "tableTo": "workspace", - "columnsFrom": ["active_workspace_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user_api_key": { - "name": "user_api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "key_preview": { - "name": "key_preview", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "user_api_key_user_id_user_id_fk": { - "name": "user_api_key_user_id_user_id_fk", - "tableFrom": "user_api_key", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": { - "unique_installation_workspace": { - "name": "unique_installation_workspace", - "columns": ["installation_id", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/0008_snapshot.json b/packages/db/drizzle/meta/0008_snapshot.json deleted file mode 100644 index 6aa1f4ab..00000000 --- a/packages/db/drizzle/meta/0008_snapshot.json +++ /dev/null @@ -1,2589 +0,0 @@ -{ - "id": "71f85ffd-25fa-4154-9cc3-68ee755060cc", - "prevId": "48f66ca1-8f8a-4ee7-85ac-a45ed4ed0ccd", - "version": "6", - "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": "varchar(255)", - "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": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "account_userId_user_id_fk": { - "name": "account_userId_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "account_provider_providerAccountId_pk": { - "name": "account_provider_providerAccountId_pk", - "columns": ["provider", "providerAccountId"] - } - }, - "uniqueConstraints": {} - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "sessionToken": { - "name": "sessionToken", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "userId": { - "name": "userId", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "session_userId_user_id_fk": { - "name": "session_userId_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["userId"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "emailVerified": { - "name": "emailVerified", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "image": { - "name": "image", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "active_workspace_id": { - "name": "active_workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false, - "default": "null" - } - }, - "indexes": {}, - "foreignKeys": { - "user_active_workspace_id_workspace_id_fk": { - "name": "user_active_workspace_id_workspace_id_fk", - "tableFrom": "user", - "tableTo": "workspace", - "columnsFrom": ["active_workspace_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.user_api_key": { - "name": "user_api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "key_preview": { - "name": "key_preview", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "user_api_key_user_id_user_id_fk": { - "name": "user_api_key_user_id_user_id_fk", - "tableFrom": "user_api_key", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_key_index": { - "name": "deployment_variable_deployment_id_key_index", - "columns": ["deployment_id", "key"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_deployment_id_deployment_id_fk": { - "name": "deployment_variable_deployment_id_deployment_id_fk", - "tableFrom": "deployment_variable", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "variable_id": { - "name": "variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_variable_id_value_index": { - "name": "deployment_variable_value_variable_id_value_index", - "columns": ["variable_id", "value"], - "isUnique": true - } - }, - "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": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target": { - "name": "deployment_variable_value_target", - "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 - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_variable_value_target_variable_value_id_target_id_index": { - "name": "deployment_variable_value_target_variable_value_id_target_id_index", - "columns": ["variable_value_id", "target_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_variable_value_target_target_id_target_id_fk": { - "name": "deployment_variable_value_target_target_id_target_id_fk", - "tableFrom": "deployment_variable_value_target", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_variable_value_target_filter": { - "name": "deployment_variable_value_target_filter", - "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 - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { - "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", - "tableFrom": "deployment_variable_value_target_filter", - "tableTo": "deployment_variable_value", - "columnsFrom": ["variable_value_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "github_config_file_id": { - "name": "github_config_file_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_system_id_slug_index": { - "name": "deployment_system_id_slug_index", - "columns": ["system_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_system_id_system_id_fk": { - "name": "deployment_system_id_system_id_fk", - "tableFrom": "deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_job_agent_id_job_agent_id_fk": { - "name": "deployment_job_agent_id_job_agent_id_fk", - "tableFrom": "deployment", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, - "deployment_github_config_file_id_github_config_file_id_fk": { - "name": "deployment_github_config_file_id_github_config_file_id_fk", - "tableFrom": "deployment", - "tableTo": "github_config_file", - "columnsFrom": ["github_config_file_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.deployment_meta_dependency": { - "name": "deployment_meta_dependency", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "depends_on_id": { - "name": "depends_on_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_meta_dependency_depends_on_id_deployment_id_index": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", - "columns": ["depends_on_id", "deployment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "deployment_meta_dependency_deployment_id_deployment_id_fk": { - "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "deployment_meta_dependency_depends_on_id_deployment_id_fk": { - "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", - "tableFrom": "deployment_meta_dependency", - "tableTo": "deployment", - "columnsFrom": ["depends_on_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment": { - "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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_filter": { - "name": "target_filter", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "environment_system_id_system_id_fk": { - "name": "environment_system_id_system_id_fk", - "tableFrom": "environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_id_environment_policy_id_fk", - "tableFrom": "environment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy": { - "name": "environment_policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "approval_required": { - "name": "approval_required", - "type": "environment_policy_approval_requirement", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'manual'" - }, - "success_status": { - "name": "success_status", - "type": "environment_policy_deployment_success_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "minimum_success": { - "name": "minimum_success", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "concurrency_type": { - "name": "concurrency_type", - "type": "concurrency_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'all'" - }, - "concurrency_limit": { - "name": "concurrency_limit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "duration": { - "name": "duration", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "evaluate_with": { - "name": "evaluate_with", - "type": "evaluation_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'none'" - }, - "evaluate": { - "name": "evaluate", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "release_sequencing": { - "name": "release_sequencing", - "type": "release_sequencing_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'cancel'" - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_system_id_system_id_fk": { - "name": "environment_policy_system_id_system_id_fk", - "tableFrom": "environment_policy", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_approval": { - "name": "environment_policy_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "approval_status_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - } - }, - "indexes": { - "environment_policy_approval_policy_id_release_id_index": { - "name": "environment_policy_approval_policy_id_release_id_index", - "columns": ["policy_id", "release_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_approval_policy_id_environment_policy_id_fk": { - "name": "environment_policy_approval_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_approval_release_id_release_id_fk": { - "name": "environment_policy_approval_release_id_release_id_fk", - "tableFrom": "environment_policy_approval", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_deployment": { - "name": "environment_policy_deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "environment_policy_deployment_policy_id_environment_id_index": { - "name": "environment_policy_deployment_policy_id_environment_id_index", - "columns": ["policy_id", "environment_id"], - "isUnique": true - } - }, - "foreignKeys": { - "environment_policy_deployment_policy_id_environment_policy_id_fk": { - "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "environment_policy_deployment_environment_id_environment_id_fk": { - "name": "environment_policy_deployment_environment_id_environment_id_fk", - "tableFrom": "environment_policy_deployment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.environment_policy_release_window": { - "name": "environment_policy_release_window", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp (0) with time zone", - "primaryKey": false, - "notNull": true - }, - "recurrence": { - "name": "recurrence", - "type": "recurrence_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "environment_policy_release_window_policy_id_environment_policy_id_fk": { - "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", - "tableFrom": "environment_policy_release_window", - "tableTo": "environment_policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_config_file": { - "name": "github_config_file", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "organization_id": { - "name": "organization_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "repository_name": { - "name": "repository_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "unique_organization_repository_path": { - "name": "unique_organization_repository_path", - "columns": ["organization_id", "repository_name", "path"], - "isUnique": true - } - }, - "foreignKeys": { - "github_config_file_organization_id_github_organization_id_fk": { - "name": "github_config_file_organization_id_github_organization_id_fk", - "tableFrom": "github_config_file", - "tableTo": "github_organization", - "columnsFrom": ["organization_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_config_file_workspace_id_workspace_id_fk": { - "name": "github_config_file_workspace_id_workspace_id_fk", - "tableFrom": "github_config_file", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_organization": { - "name": "github_organization", - "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 - }, - "organization_name": { - "name": "organization_name", - "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()" - }, - "branch": { - "name": "branch", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'main'" - } - }, - "indexes": { - "unique_installation_workspace": { - "name": "unique_installation_workspace", - "columns": ["installation_id", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "github_organization_added_by_user_id_user_id_fk": { - "name": "github_organization_added_by_user_id_user_id_fk", - "tableFrom": "github_organization", - "tableTo": "user", - "columnsFrom": ["added_by_user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "github_organization_workspace_id_workspace_id_fk": { - "name": "github_organization_workspace_id_workspace_id_fk", - "tableFrom": "github_organization", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.github_user": { - "name": "github_user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "github_user_id": { - "name": "github_user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "github_username": { - "name": "github_username", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "github_user_user_id_user_id_fk": { - "name": "github_user_user_id_user_id_fk", - "tableFrom": "github_user", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target": { - "name": "target", - "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": "'{}'" - }, - "labels": { - "name": "labels", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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 - } - }, - "indexes": { - "target_identifier_workspace_id_index": { - "name": "target_identifier_workspace_id_index", - "columns": ["identifier", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_id_target_provider_id_fk": { - "name": "target_provider_id_target_provider_id_fk", - "tableFrom": "target", - "tableTo": "target_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, - "target_workspace_id_workspace_id_fk": { - "name": "target_workspace_id_workspace_id_fk", - "tableFrom": "target", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "target_name_unique": { - "name": "target_name_unique", - "nullsNotDistinct": false, - "columns": ["name"] - } - } - }, - "public.target_schema": { - "name": "target_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": { - "target_schema_version_kind_workspace_id_index": { - "name": "target_schema_version_kind_workspace_id_index", - "columns": ["version", "kind", "workspace_id"], - "isUnique": true - } - }, - "foreignKeys": { - "target_schema_workspace_id_workspace_id_fk": { - "name": "target_schema_workspace_id_workspace_id_fk", - "tableFrom": "target_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider": { - "name": "target_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": { - "target_provider_workspace_id_name_index": { - "name": "target_provider_workspace_id_name_index", - "columns": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "target_provider_workspace_id_workspace_id_fk": { - "name": "target_provider_workspace_id_workspace_id_fk", - "tableFrom": "target_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.target_provider_google": { - "name": "target_provider_google", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_provider_id": { - "name": "target_provider_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "project_ids": { - "name": "project_ids", - "type": "text[]", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "target_provider_google_target_provider_id_target_provider_id_fk": { - "name": "target_provider_google_target_provider_id_target_provider_id_fk", - "tableFrom": "target_provider_google", - "tableTo": "target_provider", - "columnsFrom": ["target_provider_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_deployment_id_version_index": { - "name": "release_deployment_id_version_index", - "columns": ["deployment_id", "version"], - "isUnique": true - } - }, - "foreignKeys": { - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.release_dependency": { - "name": "release_dependency", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "target_label_group_id": { - "name": "target_label_group_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_type": { - "name": "rule_type", - "type": "release_dependency_rule_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "rule": { - "name": "rule", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_dependency_release_id_deployment_id_target_label_group_id_index": { - "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", - "columns": ["release_id", "deployment_id", "target_label_group_id"], - "isUnique": true - } - }, - "foreignKeys": { - "release_dependency_release_id_release_id_fk": { - "name": "release_dependency_release_id_release_id_fk", - "tableFrom": "release_dependency", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_deployment_id_deployment_id_fk": { - "name": "release_dependency_deployment_id_deployment_id_fk", - "tableFrom": "release_dependency", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_dependency_target_label_group_id_target_label_group_id_fk": { - "name": "release_dependency_target_label_group_id_target_label_group_id_fk", - "tableFrom": "release_dependency", - "tableTo": "target_label_group", - "columnsFrom": ["target_label_group_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.system": { - "name": "system", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "system_workspace_id_slug_index": { - "name": "system_workspace_id_slug_index", - "columns": ["workspace_id", "slug"], - "isUnique": true - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook": { - "name": "runbook", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": ["team_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_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": ["workspace_id", "name"], - "isUnique": true - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_config": { - "name": "job_config", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "type": { - "name": "type", - "type": "job_config_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "caused_by_id": { - "name": "caused_by_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_config_caused_by_id_user_id_fk": { - "name": "job_config_caused_by_id_user_id_fk", - "tableFrom": "job_config", - "tableTo": "user", - "columnsFrom": ["caused_by_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_release_id_release_id_fk": { - "name": "job_config_release_id_release_id_fk", - "tableFrom": "job_config", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_target_id_target_id_fk": { - "name": "job_config_target_id_target_id_fk", - "tableFrom": "job_config", - "tableTo": "target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_environment_id_environment_id_fk": { - "name": "job_config_environment_id_environment_id_fk", - "tableFrom": "job_config", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_config_runbook_id_runbook_id_fk": { - "name": "job_config_runbook_id_runbook_id_fk", - "tableFrom": "job_config", - "tableTo": "runbook", - "columnsFrom": ["runbook_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.job_execution": { - "name": "job_execution", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_config_id": { - "name": "job_config_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_run_id": { - "name": "external_run_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "job_execution_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "job_execution_reason", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'policy_passing'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "job_execution_job_config_id_job_config_id_fk": { - "name": "job_execution_job_config_id_job_config_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_config", - "columnsFrom": ["job_config_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "job_execution_job_agent_id_job_agent_id_fk": { - "name": "job_execution_job_agent_id_job_agent_id_fk", - "tableFrom": "job_execution", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "google_service_account_email": { - "name": "google_service_account_email", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - } - }, - "public.workspace_member": { - "name": "workspace_member", - "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 - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "workspace_member_workspace_id_user_id_index": { - "name": "workspace_member_workspace_id_user_id_index", - "columns": ["workspace_id", "user_id"], - "isUnique": true - } - }, - "foreignKeys": { - "workspace_member_workspace_id_workspace_id_fk": { - "name": "workspace_member_workspace_id_workspace_id_fk", - "tableFrom": "workspace_member", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_member_user_id_user_id_fk": { - "name": "workspace_member_user_id_user_id_fk", - "tableFrom": "workspace_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value": { - "name": "value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "value_set_id": { - "name": "value_set_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "value_value_set_id_key_value_index": { - "name": "value_value_set_id_key_value_index", - "columns": ["value_set_id", "key", "value"], - "isUnique": true - } - }, - "foreignKeys": { - "value_value_set_id_value_set_id_fk": { - "name": "value_value_set_id_value_set_id_fk", - "tableFrom": "value", - "tableTo": "value_set", - "columnsFrom": ["value_set_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.value_set": { - "name": "value_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": { - "value_set_system_id_system_id_fk": { - "name": "value_set_system_id_system_id_fk", - "tableFrom": "value_set", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.workspace_invite_link": { - "name": "workspace_invite_link", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_member_id": { - "name": "workspace_member_id", - "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_link_workspace_member_id_workspace_member_id_fk": { - "name": "workspace_invite_link_workspace_member_id_workspace_member_id_fk", - "tableFrom": "workspace_invite_link", - "tableTo": "workspace_member", - "columnsFrom": ["workspace_member_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_link_token_unique": { - "name": "workspace_invite_link_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - } - }, - "public.target_label_group": { - "name": "target_label_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 - } - }, - "indexes": {}, - "foreignKeys": { - "target_label_group_workspace_id_workspace_id_fk": { - "name": "target_label_group_workspace_id_workspace_id_fk", - "tableFrom": "target_label_group", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.runbook_variable": { - "name": "runbook_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "runbook_id": { - "name": "runbook_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "required": { - "name": "required", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "schema": { - "name": "schema", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": { - "public.environment_policy_approval_requirement": { - "name": "environment_policy_approval_requirement", - "schema": "public", - "values": ["manual", "automatic"] - }, - "public.approval_status_type": { - "name": "approval_status_type", - "schema": "public", - "values": ["pending", "approved", "rejected"] - }, - "public.concurrency_type": { - "name": "concurrency_type", - "schema": "public", - "values": ["all", "some"] - }, - "public.environment_policy_deployment_success_type": { - "name": "environment_policy_deployment_success_type", - "schema": "public", - "values": ["all", "some", "optional"] - }, - "public.evaluation_type": { - "name": "evaluation_type", - "schema": "public", - "values": ["semver", "regex", "none"] - }, - "public.recurrence_type": { - "name": "recurrence_type", - "schema": "public", - "values": ["hourly", "daily", "weekly", "monthly"] - }, - "public.release_sequencing_type": { - "name": "release_sequencing_type", - "schema": "public", - "values": ["wait", "cancel"] - }, - "public.release_dependency_rule_type": { - "name": "release_dependency_rule_type", - "schema": "public", - "values": ["regex", "semver"] - }, - "public.job_config_type": { - "name": "job_config_type", - "schema": "public", - "values": [ - "new_release", - "new_target", - "target_changed", - "api", - "redeploy", - "runbook" - ] - }, - "public.job_execution_reason": { - "name": "job_execution_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override" - ] - }, - "public.job_execution_status": { - "name": "job_execution_status", - "schema": "public", - "values": [ - "completed", - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found" - ] - } - }, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json deleted file mode 100644 index 4817bb6e..00000000 --- a/packages/db/drizzle/meta/_journal.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "version": "6", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "6", - "when": 1724546310308, - "tag": "0000_cool_surge", - "breakpoints": true - }, - { - "idx": 1, - "version": "6", - "when": 1724814291791, - "tag": "0001_tranquil_james_howlett", - "breakpoints": true - }, - { - "idx": 2, - "version": "6", - "when": 1724984177867, - "tag": "0002_stiff_tyger_tiger", - "breakpoints": true - }, - { - "idx": 3, - "version": "6", - "when": 1724997289931, - "tag": "0003_cloudy_jamie_braddock", - "breakpoints": true - }, - { - "idx": 4, - "version": "6", - "when": 1725038558591, - "tag": "0004_public_luminals", - "breakpoints": true - }, - { - "idx": 5, - "version": "6", - "when": 1725049430244, - "tag": "0005_thick_odin", - "breakpoints": true - }, - { - "idx": 6, - "version": "6", - "when": 1725482158482, - "tag": "0006_youthful_kitty_pryde", - "breakpoints": true - }, - { - "idx": 7, - "version": "6", - "when": 1725667085444, - "tag": "0007_thick_proteus", - "breakpoints": true - }, - { - "idx": 8, - "version": "6", - "when": 1725670707089, - "tag": "0008_gigantic_kat_farrell", - "breakpoints": true - } - ] -} From 859496f4afb163cb2ceae0e5bd367f5977c70f27 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Sat, 7 Sep 2024 19:59:02 -0700 Subject: [PATCH 08/21] fix --- packages/api/src/root.ts | 1 - packages/api/src/router/github/github.ts | 3 --- 2 files changed, 4 deletions(-) diff --git a/packages/api/src/root.ts b/packages/api/src/root.ts index a773a655..5548a809 100644 --- a/packages/api/src/root.ts +++ b/packages/api/src/root.ts @@ -2,7 +2,6 @@ import { dashboardRouter } from "./router/dashboard"; import { deploymentRouter } from "./router/deployment"; import { environmentRouter } from "./router/environment"; import { githubRouter } from "./router/github/github"; -import { invitesRouter } from "./router/invite"; import { jobRouter } from "./router/job"; import { releaseRouter } from "./router/release"; import { runtimeRouter } from "./router/runtime"; diff --git a/packages/api/src/router/github/github.ts b/packages/api/src/router/github/github.ts index 4ceb7f06..270d90b3 100644 --- a/packages/api/src/router/github/github.ts +++ b/packages/api/src/router/github/github.ts @@ -145,9 +145,6 @@ const reposRouter = createTRPCRouter({ const configFileRouter = createTRPCRouter({ list: protectedProcedure - .meta({ - access: ({ ctx, input }) => ctx.accessQuery().workspace.id(input), - }) .input(z.string().uuid()) .query(({ ctx, input }) => ctx.db From d41efe3085c3b89b4d81ee9979b84613363065bc Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Sat, 7 Sep 2024 20:01:11 -0700 Subject: [PATCH 09/21] migration --- .../db/drizzle/0011_fantastic_micromax.sql | 10 + packages/db/drizzle/meta/0011_snapshot.json | 2748 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + 3 files changed, 2765 insertions(+) create mode 100644 packages/db/drizzle/0011_fantastic_micromax.sql create mode 100644 packages/db/drizzle/meta/0011_snapshot.json diff --git a/packages/db/drizzle/0011_fantastic_micromax.sql b/packages/db/drizzle/0011_fantastic_micromax.sql new file mode 100644 index 00000000..aa4e40d3 --- /dev/null +++ b/packages/db/drizzle/0011_fantastic_micromax.sql @@ -0,0 +1,10 @@ +ALTER TABLE "deployment" DROP CONSTRAINT "deployment_job_agent_id_job_agent_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "deployment" ADD CONSTRAINT "deployment_job_agent_id_job_agent_id_fk" FOREIGN KEY ("job_agent_id") REFERENCES "public"."job_agent"("id") ON DELETE set null ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "unique_installation_workspace" ON "github_organization" ("installation_id","workspace_id");--> statement-breakpoint +ALTER TABLE "github_organization" DROP COLUMN IF EXISTS "connected"; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0011_snapshot.json b/packages/db/drizzle/meta/0011_snapshot.json new file mode 100644 index 00000000..206b1b7c --- /dev/null +++ b/packages/db/drizzle/meta/0011_snapshot.json @@ -0,0 +1,2748 @@ +{ + "id": "cfa96306-f5d0-4910-bd11-8e6645dce09f", + "prevId": "4c8c1c22-29f2-4038-8cb7-6d8f939f9087", + "version": "6", + "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": "varchar(255)", + "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": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_provider_providerAccountId_pk": { + "name": "account_provider_providerAccountId_pk", + "columns": ["provider", "providerAccountId"] + } + }, + "uniqueConstraints": {} + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "active_workspace_id": { + "name": "active_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false, + "default": "null" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_key_index": { + "name": "deployment_variable_deployment_id_key_index", + "columns": ["deployment_id", "key"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_deployment_id_deployment_id_fk": { + "name": "deployment_variable_deployment_id_deployment_id_fk", + "tableFrom": "deployment_variable", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "variable_id": { + "name": "variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_variable_id_value_index": { + "name": "deployment_variable_value_variable_id_value_index", + "columns": ["variable_id", "value"], + "isUnique": true + } + }, + "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": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target": { + "name": "deployment_variable_value_target", + "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 + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_variable_value_target_variable_value_id_target_id_index": { + "name": "deployment_variable_value_target_variable_value_id_target_id_index", + "columns": ["variable_value_id", "target_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_variable_value_target_target_id_target_id_fk": { + "name": "deployment_variable_value_target_target_id_target_id_fk", + "tableFrom": "deployment_variable_value_target", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_variable_value_target_filter": { + "name": "deployment_variable_value_target_filter", + "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 + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk": { + "name": "deployment_variable_value_target_filter_variable_value_id_deployment_variable_value_id_fk", + "tableFrom": "deployment_variable_value_target_filter", + "tableTo": "deployment_variable_value", + "columnsFrom": ["variable_value_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "github_config_file_id": { + "name": "github_config_file_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_system_id_slug_index": { + "name": "deployment_system_id_slug_index", + "columns": ["system_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_system_id_system_id_fk": { + "name": "deployment_system_id_system_id_fk", + "tableFrom": "deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_job_agent_id_job_agent_id_fk": { + "name": "deployment_job_agent_id_job_agent_id_fk", + "tableFrom": "deployment", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "deployment_github_config_file_id_github_config_file_id_fk": { + "name": "deployment_github_config_file_id_github_config_file_id_fk", + "tableFrom": "deployment", + "tableTo": "github_config_file", + "columnsFrom": ["github_config_file_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.deployment_meta_dependency": { + "name": "deployment_meta_dependency", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "depends_on_id": { + "name": "depends_on_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_meta_dependency_depends_on_id_deployment_id_index": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_index", + "columns": ["depends_on_id", "deployment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "deployment_meta_dependency_deployment_id_deployment_id_fk": { + "name": "deployment_meta_dependency_deployment_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "deployment_meta_dependency_depends_on_id_deployment_id_fk": { + "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk", + "tableFrom": "deployment_meta_dependency", + "tableTo": "deployment", + "columnsFrom": ["depends_on_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment": { + "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 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_filter": { + "name": "target_filter", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "environment_system_id_system_id_fk": { + "name": "environment_system_id_system_id_fk", + "tableFrom": "environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_id_environment_policy_id_fk", + "tableFrom": "environment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy": { + "name": "environment_policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "approval_required": { + "name": "approval_required", + "type": "environment_policy_approval_requirement", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'manual'" + }, + "success_status": { + "name": "success_status", + "type": "environment_policy_deployment_success_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "minimum_success": { + "name": "minimum_success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "concurrency_type": { + "name": "concurrency_type", + "type": "concurrency_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'all'" + }, + "concurrency_limit": { + "name": "concurrency_limit", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "duration": { + "name": "duration", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "evaluate_with": { + "name": "evaluate_with", + "type": "evaluation_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "evaluate": { + "name": "evaluate", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "release_sequencing": { + "name": "release_sequencing", + "type": "release_sequencing_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'cancel'" + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_system_id_system_id_fk": { + "name": "environment_policy_system_id_system_id_fk", + "tableFrom": "environment_policy", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_approval": { + "name": "environment_policy_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "approval_status_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + } + }, + "indexes": { + "environment_policy_approval_policy_id_release_id_index": { + "name": "environment_policy_approval_policy_id_release_id_index", + "columns": ["policy_id", "release_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_approval_policy_id_environment_policy_id_fk": { + "name": "environment_policy_approval_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_approval_release_id_release_id_fk": { + "name": "environment_policy_approval_release_id_release_id_fk", + "tableFrom": "environment_policy_approval", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_deployment": { + "name": "environment_policy_deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "environment_policy_deployment_policy_id_environment_id_index": { + "name": "environment_policy_deployment_policy_id_environment_id_index", + "columns": ["policy_id", "environment_id"], + "isUnique": true + } + }, + "foreignKeys": { + "environment_policy_deployment_policy_id_environment_policy_id_fk": { + "name": "environment_policy_deployment_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "environment_policy_deployment_environment_id_environment_id_fk": { + "name": "environment_policy_deployment_environment_id_environment_id_fk", + "tableFrom": "environment_policy_deployment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.environment_policy_release_window": { + "name": "environment_policy_release_window", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp (0) with time zone", + "primaryKey": false, + "notNull": true + }, + "recurrence": { + "name": "recurrence", + "type": "recurrence_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "environment_policy_release_window_policy_id_environment_policy_id_fk": { + "name": "environment_policy_release_window_policy_id_environment_policy_id_fk", + "tableFrom": "environment_policy_release_window", + "tableTo": "environment_policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_config_file": { + "name": "github_config_file", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "repository_name": { + "name": "repository_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_synced_at": { + "name": "last_synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "unique_organization_repository_path": { + "name": "unique_organization_repository_path", + "columns": ["organization_id", "repository_name", "path"], + "isUnique": true + } + }, + "foreignKeys": { + "github_config_file_organization_id_github_organization_id_fk": { + "name": "github_config_file_organization_id_github_organization_id_fk", + "tableFrom": "github_config_file", + "tableTo": "github_organization", + "columnsFrom": ["organization_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_config_file_workspace_id_workspace_id_fk": { + "name": "github_config_file_workspace_id_workspace_id_fk", + "tableFrom": "github_config_file", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_organization": { + "name": "github_organization", + "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 + }, + "organization_name": { + "name": "organization_name", + "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()" + }, + "branch": { + "name": "branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'main'" + } + }, + "indexes": { + "unique_installation_workspace": { + "name": "unique_installation_workspace", + "columns": ["installation_id", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "github_organization_added_by_user_id_user_id_fk": { + "name": "github_organization_added_by_user_id_user_id_fk", + "tableFrom": "github_organization", + "tableTo": "user", + "columnsFrom": ["added_by_user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_organization_workspace_id_workspace_id_fk": { + "name": "github_organization_workspace_id_workspace_id_fk", + "tableFrom": "github_organization", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.github_user": { + "name": "github_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "github_user_id": { + "name": "github_user_id", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "github_user_user_id_user_id_fk": { + "name": "github_user_user_id_user_id_fk", + "tableFrom": "github_user", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target": { + "name": "target", + "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": "'{}'" + }, + "labels": { + "name": "labels", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "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 + } + }, + "indexes": { + "target_identifier_workspace_id_index": { + "name": "target_identifier_workspace_id_index", + "columns": ["identifier", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_id_target_provider_id_fk": { + "name": "target_provider_id_target_provider_id_fk", + "tableFrom": "target", + "tableTo": "target_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "target_workspace_id_workspace_id_fk": { + "name": "target_workspace_id_workspace_id_fk", + "tableFrom": "target", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "target_name_unique": { + "name": "target_name_unique", + "nullsNotDistinct": false, + "columns": ["name"] + } + } + }, + "public.target_schema": { + "name": "target_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": { + "target_schema_version_kind_workspace_id_index": { + "name": "target_schema_version_kind_workspace_id_index", + "columns": ["version", "kind", "workspace_id"], + "isUnique": true + } + }, + "foreignKeys": { + "target_schema_workspace_id_workspace_id_fk": { + "name": "target_schema_workspace_id_workspace_id_fk", + "tableFrom": "target_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider": { + "name": "target_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": { + "target_provider_workspace_id_name_index": { + "name": "target_provider_workspace_id_name_index", + "columns": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "target_provider_workspace_id_workspace_id_fk": { + "name": "target_provider_workspace_id_workspace_id_fk", + "tableFrom": "target_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.target_provider_google": { + "name": "target_provider_google", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_provider_id": { + "name": "target_provider_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_ids": { + "name": "project_ids", + "type": "text[]", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "target_provider_google_target_provider_id_target_provider_id_fk": { + "name": "target_provider_google_target_provider_id_target_provider_id_fk", + "tableFrom": "target_provider_google", + "tableTo": "target_provider", + "columnsFrom": ["target_provider_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release": { + "name": "release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_deployment_id_version_index": { + "name": "release_deployment_id_version_index", + "columns": ["deployment_id", "version"], + "isUnique": true + } + }, + "foreignKeys": { + "release_deployment_id_deployment_id_fk": { + "name": "release_deployment_id_deployment_id_fk", + "tableFrom": "release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.release_dependency": { + "name": "release_dependency", + "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 + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "target_label_group_id": { + "name": "target_label_group_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rule_type": { + "name": "rule_type", + "type": "release_dependency_rule_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "rule": { + "name": "rule", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "release_dependency_release_id_deployment_id_target_label_group_id_index": { + "name": "release_dependency_release_id_deployment_id_target_label_group_id_index", + "columns": ["release_id", "deployment_id", "target_label_group_id"], + "isUnique": true + } + }, + "foreignKeys": { + "release_dependency_release_id_release_id_fk": { + "name": "release_dependency_release_id_release_id_fk", + "tableFrom": "release_dependency", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_deployment_id_deployment_id_fk": { + "name": "release_dependency_deployment_id_deployment_id_fk", + "tableFrom": "release_dependency", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_dependency_target_label_group_id_target_label_group_id_fk": { + "name": "release_dependency_target_label_group_id_target_label_group_id_fk", + "tableFrom": "release_dependency", + "tableTo": "target_label_group", + "columnsFrom": ["target_label_group_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.system": { + "name": "system", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "system_workspace_id_slug_index": { + "name": "system_workspace_id_slug_index", + "columns": ["workspace_id", "slug"], + "isUnique": true + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook": { + "name": "runbook", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": ["team_id", "user_id"], + "isUnique": true + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_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": ["workspace_id", "name"], + "isUnique": true + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_config": { + "name": "job_config", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "type": { + "name": "type", + "type": "job_config_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "caused_by_id": { + "name": "caused_by_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_config_caused_by_id_user_id_fk": { + "name": "job_config_caused_by_id_user_id_fk", + "tableFrom": "job_config", + "tableTo": "user", + "columnsFrom": ["caused_by_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_release_id_release_id_fk": { + "name": "job_config_release_id_release_id_fk", + "tableFrom": "job_config", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_target_id_target_id_fk": { + "name": "job_config_target_id_target_id_fk", + "tableFrom": "job_config", + "tableTo": "target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_environment_id_environment_id_fk": { + "name": "job_config_environment_id_environment_id_fk", + "tableFrom": "job_config", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_config_runbook_id_runbook_id_fk": { + "name": "job_config_runbook_id_runbook_id_fk", + "tableFrom": "job_config", + "tableTo": "runbook", + "columnsFrom": ["runbook_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.job_execution": { + "name": "job_execution", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_config_id": { + "name": "job_config_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_run_id": { + "name": "external_run_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "job_execution_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "job_execution_reason", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'policy_passing'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "job_execution_job_config_id_job_config_id_fk": { + "name": "job_execution_job_config_id_job_config_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_config", + "columnsFrom": ["job_config_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "job_execution_job_agent_id_job_agent_id_fk": { + "name": "job_execution_job_agent_id_job_agent_id_fk", + "tableFrom": "job_execution", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "google_service_account_email": { + "name": "google_service_account_email", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + } + }, + "public.value": { + "name": "value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "value_set_id": { + "name": "value_set_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "value_value_set_id_key_value_index": { + "name": "value_value_set_id_key_value_index", + "columns": ["value_set_id", "key", "value"], + "isUnique": true + } + }, + "foreignKeys": { + "value_value_set_id_value_set_id_fk": { + "name": "value_value_set_id_value_set_id_fk", + "tableFrom": "value", + "tableTo": "value_set", + "columnsFrom": ["value_set_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.value_set": { + "name": "value_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": { + "value_set_system_id_system_id_fk": { + "name": "value_set_system_id_system_id_fk", + "tableFrom": "value_set", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.workspace_invite_token": { + "name": "workspace_invite_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_invite_token_role_id_role_id_fk": { + "name": "workspace_invite_token_role_id_role_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_workspace_id_workspace_id_fk": { + "name": "workspace_invite_token_workspace_id_workspace_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_created_by_user_id_fk": { + "name": "workspace_invite_token_created_by_user_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_token_token_unique": { + "name": "workspace_invite_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + } + }, + "public.target_label_group": { + "name": "target_label_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 + } + }, + "indexes": {}, + "foreignKeys": { + "target_label_group_workspace_id_workspace_id_fk": { + "name": "target_label_group_workspace_id_workspace_id_fk", + "tableFrom": "target_label_group", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.runbook_variable": { + "name": "runbook_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "runbook_id": { + "name": "runbook_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "default_value": { + "name": "default_value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "schema": { + "name": "schema", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "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": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.entity_role": { + "name": "entity_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "scope_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": { + "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index", + "columns": [ + "role_id", + "entity_type", + "entity_id", + "scope_id", + "scope_type" + ], + "isUnique": true + } + }, + "foreignKeys": { + "entity_role_role_id_role_id_fk": { + "name": "entity_role_role_id_role_id_fk", + "tableFrom": "entity_role", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "role_workspace_id_workspace_id_fk": { + "name": "role_workspace_id_workspace_id_fk", + "tableFrom": "role", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.role_permission": { + "name": "role_permission", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "role_permission_role_id_permission_index": { + "name": "role_permission_role_id_permission_index", + "columns": ["role_id", "permission"], + "isUnique": true + } + }, + "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": {} + } + }, + "enums": { + "public.environment_policy_approval_requirement": { + "name": "environment_policy_approval_requirement", + "schema": "public", + "values": ["manual", "automatic"] + }, + "public.approval_status_type": { + "name": "approval_status_type", + "schema": "public", + "values": ["pending", "approved", "rejected"] + }, + "public.concurrency_type": { + "name": "concurrency_type", + "schema": "public", + "values": ["all", "some"] + }, + "public.environment_policy_deployment_success_type": { + "name": "environment_policy_deployment_success_type", + "schema": "public", + "values": ["all", "some", "optional"] + }, + "public.evaluation_type": { + "name": "evaluation_type", + "schema": "public", + "values": ["semver", "regex", "none"] + }, + "public.recurrence_type": { + "name": "recurrence_type", + "schema": "public", + "values": ["hourly", "daily", "weekly", "monthly"] + }, + "public.release_sequencing_type": { + "name": "release_sequencing_type", + "schema": "public", + "values": ["wait", "cancel"] + }, + "public.release_dependency_rule_type": { + "name": "release_dependency_rule_type", + "schema": "public", + "values": ["regex", "semver"] + }, + "public.job_config_type": { + "name": "job_config_type", + "schema": "public", + "values": [ + "new_release", + "new_target", + "target_changed", + "api", + "redeploy", + "runbook" + ] + }, + "public.job_execution_reason": { + "name": "job_execution_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override" + ] + }, + "public.job_execution_status": { + "name": "job_execution_status", + "schema": "public", + "values": [ + "completed", + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found" + ] + }, + "public.entity_type": { + "name": "entity_type", + "schema": "public", + "values": ["user", "team"] + }, + "public.scope_type": { + "name": "scope_type", + "schema": "public", + "values": [ + "release", + "target", + "targetProvider", + "targetLabelGroup", + "workspace", + "environment", + "environmentPolicy", + "valueSet", + "system", + "deployment", + "jobAgent" + ] + } + }, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index b88cf530..db8b624f 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -78,6 +78,13 @@ "when": 1725682116384, "tag": "0010_fearless_blink", "breakpoints": true + }, + { + "idx": 11, + "version": "6", + "when": 1725764417741, + "tag": "0011_fantastic_micromax", + "breakpoints": true } ] } From 9009d39b467e2c02d1c5ba3a5d8e4f99ba658a3a Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Sat, 7 Sep 2024 20:58:53 -0700 Subject: [PATCH 10/21] rbac + more cleanup --- .../github/GithubAddOrgDialog.tsx | 25 +- .../github/GithubConnectedOrgs.tsx | 14 + .../github/GithubRemoveOrgDialog.tsx | 1 + .../SelectPreconnectedOrgDialogContent.tsx | 7 +- .../job-agent/ConfigureJobAgentGithub.tsx | 5 +- .../configure/job-agent/page.tsx | 16 +- packages/api/src/router/github.ts | 423 ------------------ packages/api/src/router/github/github.ts | 239 ++++++---- packages/validators/src/auth/index.ts | 2 + 9 files changed, 204 insertions(+), 528 deletions(-) delete mode 100644 packages/api/src/router/github.ts diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx index 51a05dfe..ec232976 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubAddOrgDialog.tsx @@ -15,9 +15,12 @@ import { DialogTrigger, } from "@ctrlplane/ui/dialog"; -import { api } from "~/trpc/react"; import { Callout } from "../../../../../../_components/Callout"; -import { SelectPreconnectedOrgDialogContent } from "./SelectPreconnectedOrgDialogContent"; +import type { + GithubOrg} from "./SelectPreconnectedOrgDialogContent"; +import { + SelectPreconnectedOrgDialogContent, +} from "./SelectPreconnectedOrgDialogContent"; type GithubAddOrgDialogProps = { githubUser: GithubUser; @@ -27,6 +30,7 @@ type GithubAddOrgDialogProps = { botName: string; clientId: string; }; + validOrgsToAdd: GithubOrg[]; workspaceId: string; }; @@ -34,22 +38,9 @@ export const GithubAddOrgDialog: React.FC = ({ githubUser, children, githubConfig, + validOrgsToAdd, workspaceId, }) => { - const githubOrgs = api.github.organizations.byGithubUserId.useQuery( - githubUser.githubUserId, - ); - const githubOrgsInstalled = - api.github.organizations.list.useQuery(workspaceId); - - const validOrgsToAdd = - githubOrgs.data?.filter( - (org) => - !githubOrgsInstalled.data?.some( - (o) => o.organizationName === org.login, - ), - ) ?? []; - const [dialogStep, setDialogStep] = useState<"choose-org" | "pre-connected">( "choose-org", ); @@ -124,7 +115,7 @@ export const GithubAddOrgDialog: React.FC = ({ {dialogStep === "pre-connected" && ( setDialogStep("choose-org")} diff --git a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx index 9d3a75be..258e13bb 100644 --- a/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/settings/(settings)/workspace/integrations/(integration)/github/GithubConnectedOrgs.tsx @@ -38,7 +38,20 @@ export const GithubConnectedOrgs: React.FC = async ({ workspaceId, githubConfig, }) => { + const githubOrgsUserCanAccess = + githubUser != null + ? await api.github.organizations.byGithubUserId({ + workspaceId, + githubUserId: githubUser.githubUserId, + }) + : []; const githubOrgsInstalled = await api.github.organizations.list(workspaceId); + const validOrgsToAdd = githubOrgsUserCanAccess.filter( + (org) => + !githubOrgsInstalled.some( + (installedOrg) => installedOrg.organizationName === org.login, + ), + ); return ( @@ -57,6 +70,7 @@ export const GithubConnectedOrgs: React.FC = async ({ githubUser={githubUser} githubConfig={githubConfig} workspaceId={workspaceId} + validOrgsToAdd={validOrgsToAdd} >