diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/EnvironmentNode.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/EnvironmentNode.tsx
index c79cc112d..ef200b373 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/EnvironmentNode.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/checks/_components/flow-diagram/EnvironmentNode.tsx
@@ -20,9 +20,9 @@ import { Separator } from "@ctrlplane/ui/separator";
import {
ColumnOperator,
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
-import { JobFilterType, JobStatus } from "@ctrlplane/validators/jobs";
+import { JobConditionType, JobStatus } from "@ctrlplane/validators/jobs";
import { useDeploymentVersionChannelDrawer } from "~/app/[workspaceSlug]/(app)/_components/channel/drawer/useDeploymentVersionChannelDrawer";
import { useDeploymentVersionChannel } from "~/app/[workspaceSlug]/(app)/_hooks/channel/useDeploymentVersionChannel";
@@ -45,44 +45,44 @@ const WaitingOnActiveCheck: React.FC = ({
environmentId,
}) => {
const isSameEnvironment: EnvironmentCondition = {
- type: JobFilterType.Environment,
+ type: JobConditionType.Environment,
operator: ColumnOperator.Equals,
value: environmentId,
};
const isPending: StatusCondition = {
- type: JobFilterType.Status,
+ type: JobConditionType.Status,
operator: ColumnOperator.Equals,
value: JobStatus.Pending,
};
const isInProgress: StatusCondition = {
- type: JobFilterType.Status,
+ type: JobConditionType.Status,
operator: ColumnOperator.Equals,
value: JobStatus.InProgress,
};
const isSameVersion: JobReleaseCondition = {
- type: JobFilterType.Release,
+ type: JobConditionType.Release,
operator: ColumnOperator.Equals,
value: versionId,
};
const isDifferentVersion: JobCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: true,
conditions: [isSameVersion],
};
- const pendingJobsForCurrentVersionAndEnvFilter: JobCondition = {
- type: FilterType.Comparison,
+ const pendingJobsForCurrentVersionAndEnvSelector: JobCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [isSameEnvironment, isPending, isSameVersion],
};
- const inProgressJobsForDifferentVersionAndCurrentEnvFilter: JobCondition = {
- type: FilterType.Comparison,
+ const inProgressJobsForDifferentVersionAndCurrentEnvSelector: JobCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [isSameEnvironment, isInProgress, isDifferentVersion],
};
@@ -90,7 +90,7 @@ const WaitingOnActiveCheck: React.FC = ({
const pendingJobsQ = api.job.config.byWorkspaceId.list.useQuery(
{
workspaceId,
- filter: pendingJobsForCurrentVersionAndEnvFilter,
+ filter: pendingJobsForCurrentVersionAndEnvSelector,
limit: 1,
},
{ refetchInterval: 5_000 },
@@ -99,7 +99,7 @@ const WaitingOnActiveCheck: React.FC = ({
const inProgressJobsQ = api.job.config.byWorkspaceId.list.useQuery(
{
workspaceId,
- filter: inProgressJobsForDifferentVersionAndCurrentEnvFilter,
+ filter: inProgressJobsForDifferentVersionAndCurrentEnvSelector,
limit: 1,
},
{ refetchInterval: 5_000 },
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/release-table/ResourceReleaseTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/release-table/ResourceReleaseTable.tsx
index de88a3f4b..b9bed29bb 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/release-table/ResourceReleaseTable.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/release-table/ResourceReleaseTable.tsx
@@ -37,7 +37,7 @@ import { useJobDrawer } from "~/app/[workspaceSlug]/(app)/_components/job/drawer
import { JobDropdownMenu } from "~/app/[workspaceSlug]/(app)/_components/job/JobDropdownMenu";
import { JobTableStatusIcon } from "~/app/[workspaceSlug]/(app)/_components/job/JobTableStatusIcon";
import { useDeploymentVersionChannel } from "~/app/[workspaceSlug]/(app)/_hooks/channel/useDeploymentVersionChannel";
-import { useFilter } from "~/app/[workspaceSlug]/(app)/_hooks/useFilter";
+import { useCondition } from "~/app/[workspaceSlug]/(app)/_hooks/useCondition";
import { Sidebars } from "~/app/[workspaceSlug]/sidebars";
import { api } from "~/trpc/react";
import { EnvironmentApprovalRow } from "./EnvironmentApprovalRow";
@@ -471,9 +471,9 @@ export const ResourceReleaseTable: React.FC = ({
deployment,
environments,
}) => {
- const { filter, setFilter } = useFilter();
+ const { condition, setCondition } = useCondition();
const releaseJobTriggerQuery = api.job.config.byDeploymentVersionId.useQuery(
- { versionId: deploymentVersion.id, filter: filter ?? undefined },
+ { versionId: deploymentVersion.id, condition: condition ?? undefined },
{ refetchInterval: 5_000 },
);
const releaseJobTriggers = releaseJobTriggerQuery.data ?? [];
@@ -499,12 +499,12 @@ export const ResourceReleaseTable: React.FC = ({
-
+
- {filter != null && }
+ {condition != null && }
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/DeploymentPageContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/DeploymentPageContent.tsx
index 7a3a0a353..de55e91a0 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/DeploymentPageContent.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/DeploymentPageContent.tsx
@@ -35,7 +35,7 @@ import {
} from "@ctrlplane/ui/tooltip";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { DeploymentVersionStatus } from "@ctrlplane/validators/releases";
@@ -62,18 +62,20 @@ const EnvHeader: React.FC = ({
deployment,
workspace,
}) => {
- const { resourceFilter: envResourceFilter } = environment;
- const { resourceFilter: deploymentResourceFilter } = deployment;
+ const { resourceSelector: envResourceSelector } = environment;
+ const { resourceSelector: deploymentResourceSelector } = deployment;
- const filter: ResourceCondition = {
- type: FilterType.Comparison,
+ const condition: ResourceCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [envResourceFilter, deploymentResourceFilter].filter(isPresent),
+ conditions: [envResourceSelector, deploymentResourceSelector].filter(
+ isPresent,
+ ),
};
const { data, isLoading } = api.resource.byWorkspaceId.list.useQuery(
- { workspaceId: workspace.id, filter, limit: 0 },
- { enabled: envResourceFilter != null },
+ { workspaceId: workspace.id, filter: condition, limit: 0 },
+ { enabled: envResourceSelector != null },
);
const total = data?.total ?? 0;
@@ -105,21 +107,21 @@ const DirectoryHeader: React.FC = ({
directory,
workspace,
}) => {
- const resourceFilters = directory.environments
- .map((env) => env.resourceFilter)
+ const resourceSelectors = directory.environments
+ .map((env) => env.resourceSelector)
.filter(isPresent);
- const filter: ResourceCondition | undefined =
- resourceFilters.length > 0
+ const condition: ResourceCondition | undefined =
+ resourceSelectors.length > 0
? {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
- conditions: resourceFilters,
+ conditions: resourceSelectors,
}
: undefined;
const { data, isLoading } = api.resource.byWorkspaceId.list.useQuery(
- { workspaceId: workspace.id, filter, limit: 0 },
- { enabled: filter != null },
+ { workspaceId: workspace.id, filter: condition, limit: 0 },
+ { enabled: condition != null },
);
const total = data?.total ?? 0;
@@ -164,7 +166,7 @@ export const DeploymentPageContent: React.FC = ({
const { systemSlug } = useParams<{ systemSlug: string }>();
const versions = api.deployment.version.list.useQuery(
- { deploymentId: deployment.id, selector: selector ?? undefined, limit: 30 },
+ { deploymentId: deployment.id, filter: selector ?? undefined, limit: 30 },
{ refetchInterval: 2_000 },
);
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/DeploymentVersionEnvironmentCell.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/DeploymentVersionEnvironmentCell.tsx
index fc2dc59d6..f73b87a61 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/DeploymentVersionEnvironmentCell.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/DeploymentVersionEnvironmentCell.tsx
@@ -12,7 +12,7 @@ import { Button } from "@ctrlplane/ui/button";
import { Skeleton } from "@ctrlplane/ui/skeleton";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { JobStatus } from "@ctrlplane/validators/jobs";
import { DeploymentVersionStatus } from "@ctrlplane/validators/releases";
@@ -48,22 +48,22 @@ const useGetResourceCount = (
const { data: workspace, isLoading: isWorkspaceLoading } =
api.workspace.bySlug.useQuery(workspaceSlug);
- const filter: ResourceCondition | undefined =
- environment.resourceFilter != null
+ const condition: ResourceCondition | undefined =
+ environment.resourceSelector != null
? {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [
- environment.resourceFilter,
- deployment.resourceFilter,
+ environment.resourceSelector,
+ deployment.resourceSelector,
].filter(isPresent),
}
: undefined;
const { data: resources, isLoading: isResourcesLoading } =
api.resource.byWorkspaceId.list.useQuery(
- { workspaceId: workspace?.id ?? "", filter, limit: 0 },
- { enabled: workspace != null && filter != null },
+ { workspaceId: workspace?.id ?? "", filter: condition, limit: 0 },
+ { enabled: workspace != null && condition != null },
);
return {
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/JobHistoryPopover.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/JobHistoryPopover.tsx
index c413900ca..591f62968 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/JobHistoryPopover.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/JobHistoryPopover.tsx
@@ -5,7 +5,7 @@ import React from "react";
import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover";
import { ColumnOperator } from "@ctrlplane/validators/conditions";
-import { JobFilterType } from "@ctrlplane/validators/jobs";
+import { JobConditionType } from "@ctrlplane/validators/jobs";
import { DailyJobsChart } from "~/app/[workspaceSlug]/(app)/insights/DailyJobsChart";
import { api } from "~/trpc/react";
@@ -25,8 +25,8 @@ export const JobHistoryPopover: React.FC = ({
{ refetchInterval: 60_000 },
);
- const inDeploymentFilter: JobCondition = {
- type: JobFilterType.Deployment,
+ const inDeploymentSelector: JobCondition = {
+ type: JobConditionType.Deployment,
operator: ColumnOperator.Equals,
value: deploymentId,
};
@@ -42,7 +42,7 @@ export const JobHistoryPopover: React.FC = ({
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx
index e0c35ba74..28d52f3a0 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/_components/release-cell/TableCells.tsx
@@ -31,11 +31,11 @@ import {
import {
ColumnOperator,
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import {
activeStatusType,
- JobFilterType,
+ JobConditionType,
JobStatus,
} from "@ctrlplane/validators/jobs";
@@ -144,19 +144,19 @@ export const DeploymentVersion: React.FC<{
} = props;
const isSameVersion: JobCondition = {
- type: JobFilterType.Release,
+ type: JobConditionType.Release,
operator: ColumnOperator.Equals,
value: versionId,
};
const isSameEnvironment: JobCondition = {
- type: JobFilterType.Environment,
+ type: JobConditionType.Environment,
operator: ColumnOperator.Equals,
value: environment.id,
};
const filter: JobCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [isSameVersion, isSameEnvironment],
};
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/channels/CreateDeploymentVersionChannelDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/channels/CreateDeploymentVersionChannelDialog.tsx
index ea61a2908..90c075b1a 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/channels/CreateDeploymentVersionChannelDialog.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/channels/CreateDeploymentVersionChannelDialog.tsx
@@ -99,7 +99,7 @@ export const CreateDeploymentVersionChannelDialog: React.FC<
selectorHash != null ? `${baseUrl}?selector=${selectorHash}` : baseUrl;
const versionsQ = api.deployment.version.list.useQuery(
- { deploymentId, selector, limit: 5 },
+ { deploymentId, filter: selector, limit: 5 },
{ enabled: selector != null, placeholderData: (prev) => prev },
);
const versions = versionsQ.data;
@@ -165,7 +165,7 @@ export const CreateDeploymentVersionChannelDialog: React.FC<
className="flex items-center gap-2"
>
- Edit filter
+ Edit selector
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/DeploymentResourcesDialog.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/DeploymentResourcesDialog.tsx
index be07d45c8..d6417acc0 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/DeploymentResourcesDialog.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/DeploymentResourcesDialog.tsx
@@ -21,7 +21,7 @@ import {
} from "@ctrlplane/ui/select";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { isValidResourceCondition } from "@ctrlplane/validators/resources";
@@ -32,31 +32,32 @@ import { api } from "~/trpc/react";
type Environment = {
id: string;
name: string;
- resourceFilter: ResourceCondition;
+ resourceSelector: ResourceCondition;
};
type DeploymentResourcesDialogProps = {
environments: Environment[];
- resourceFilter: ResourceCondition;
+ resourceSelector: ResourceCondition;
workspaceId: string;
};
export const DeploymentResourcesDialog: React.FC<
DeploymentResourcesDialogProps
-> = ({ environments, resourceFilter, workspaceId }) => {
+> = ({ environments, resourceSelector, workspaceId }) => {
const [selectedEnvironment, setSelectedEnvironment] =
useState(environments[0] ?? null);
- const filter: ResourceCondition = {
- type: FilterType.Comparison,
+ const condition: ResourceCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [selectedEnvironment?.resourceFilter, resourceFilter].filter(
- isPresent,
- ),
+ conditions: [
+ selectedEnvironment?.resourceSelector,
+ resourceSelector,
+ ].filter(isPresent),
};
- const isFilterValid = isValidResourceCondition(filter);
+ const isFilterValid = isValidResourceCondition(condition);
const { data, isLoading } = api.resource.byWorkspaceId.list.useQuery(
- { workspaceId, filter, limit: 5 },
+ { workspaceId, filter: condition, limit: 5 },
{ enabled: selectedEnvironment != null && isFilterValid },
);
@@ -71,7 +72,7 @@ export const DeploymentResourcesDialog: React.FC<
variant="outline"
className="flex items-center gap-2"
type="button"
- disabled={!isValidResourceCondition(resourceFilter)}
+ disabled={!isValidResourceCondition(resourceSelector)}
>
View Resources
@@ -81,7 +82,7 @@ export const DeploymentResourcesDialog: React.FC<
View Resources
Select an environment to view the resources based on the combined
- environment and deployment filter.
+ environment and deployment selector.
@@ -106,12 +107,15 @@ export const DeploymentResourcesDialog: React.FC<
{selectedEnvironment != null && (
<>
- {}} />
+ {}}
+ />
{!isLoading && (
)}
>
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/EditDeploymentSection.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/EditDeploymentSection.tsx
index 53898cff8..a8a9a0b1a 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/EditDeploymentSection.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/properties/EditDeploymentSection.tsx
@@ -96,17 +96,17 @@ export const EditDeploymentSection: React.FC = ({
resourceFilter: false,
});
- const envsWithFilter =
+ const envsWithSelector =
system?.environments
- .filter((e) => e.resourceFilter != null)
- .map((e) => ({ ...e, resourceFilter: e.resourceFilter! })) ?? [];
+ .filter((e) => e.resourceSelector != null)
+ .map((e) => ({ ...e, resourceSelector: e.resourceSelector! })) ?? [];
- const resourceFilter = deployment.resourceFilter ?? undefined;
+ const resourceSelector = deployment.resourceSelector ?? undefined;
const timeout =
deployment.timeout != null
? prettyMilliseconds(deployment.timeout)
: undefined;
- const defaultValues = { ...deployment, resourceFilter, timeout };
+ const defaultValues = { ...deployment, resourceSelector, timeout };
const form = useForm({ schema, defaultValues, mode: "onSubmit" });
const { setError, formState, watch, getValues } = form;
@@ -127,16 +127,16 @@ export const EditDeploymentSection: React.FC = ({
const onSubmit = async (section: string) => {
try {
const currentValues = getValues();
- const filter =
- currentValues.resourceFilter == null ||
- isEmptyCondition(currentValues.resourceFilter)
+ const selector =
+ currentValues.resourceSelector == null ||
+ isEmptyCondition(currentValues.resourceSelector)
? null
- : currentValues.resourceFilter;
+ : currentValues.resourceSelector;
const timeout =
currentValues.timeout != null && currentValues.timeout !== ""
? ms(currentValues.timeout) / 1000
: null;
- const updates = { ...currentValues, resourceFilter: filter, timeout };
+ const updates = { ...currentValues, resourceSelector: selector, timeout };
const updatedDeployment = await updateDeployment.mutateAsync({
id: deployment.id,
@@ -168,7 +168,7 @@ export const EditDeploymentSection: React.FC = ({
const watchSystemId = watch("systemId");
const watchRetryCount = watch("retryCount");
const watchTimeout = watch("timeout");
- const watchResourceFilter = watch("resourceFilter");
+ const watchResourceSelector = watch("resourceSelector");
const propertiesDirty =
watchName !== defaultValues.name ||
@@ -180,9 +180,9 @@ export const EditDeploymentSection: React.FC = ({
watchRetryCount !== defaultValues.retryCount ||
watchTimeout !== defaultValues.timeout;
- const resourceFilterDirty =
- JSON.stringify(watchResourceFilter) !==
- JSON.stringify(defaultValues.resourceFilter);
+ const resourceSelectorDirty =
+ JSON.stringify(watchResourceSelector) !==
+ JSON.stringify(defaultValues.resourceSelector);
return (
@@ -396,7 +396,7 @@ export const EditDeploymentSection: React.FC
= ({
(
Resource Filter
@@ -419,10 +419,10 @@ export const EditDeploymentSection: React.FC = ({
Clear Filter
- {envsWithFilter.length > 0 && value != null && (
+ {envsWithSelector.length > 0 && value != null && (
)}
@@ -438,10 +438,10 @@ export const EditDeploymentSection: React.FC = ({
variant="outline"
size="sm"
className="gap-2"
- onClick={() => onSubmit("resourceFilter")}
- disabled={!resourceFilterDirty || formState.isSubmitting}
+ onClick={() => onSubmit("resourceSelector")}
+ disabled={!resourceSelectorDirty || formState.isSubmitting}
>
- {successMessages.resourceFilter ? "Saved" : "Save"}
+ {successMessages.resourceSelector ? "Saved" : "Save"}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/ConfigFields.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/ConfigFields.tsx
index c340813c1..4ec244cda 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/ConfigFields.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/ConfigFields.tsx
@@ -275,7 +275,7 @@ type RunbookConfigFieldsFC = React.FC<{
export const ResourceConfigFields: RunbookConfigFieldsFC<
ResourceVariableConfigType
> = ({ config, updateConfig }) => {
- const onFilterChange = (condition: ResourceCondition | null) => {
+ const onSelectorChange = (condition: ResourceCondition | null) => {
const cond = condition ?? defaultCondition;
if (isEmptyCondition(cond)) updateConfig({ ...config, filter: undefined });
if (!isEmptyCondition(cond)) updateConfig({ ...config, filter: cond });
@@ -286,7 +286,7 @@ export const ResourceConfigFields: RunbookConfigFieldsFC<
{config.filter && }
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableResourceInput.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableResourceInput.tsx
index facbf80e4..b5df75ca2 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableResourceInput.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableResourceInput.tsx
@@ -18,7 +18,7 @@ import {
import { Popover, PopoverContent, PopoverTrigger } from "@ctrlplane/ui/popover";
import { ColumnOperator } from "@ctrlplane/validators/conditions";
import {
- ResourceFilterType,
+ ResourceConditionType,
ResourceOperator,
} from "@ctrlplane/validators/resources";
@@ -29,7 +29,7 @@ import { api } from "~/trpc/react";
*/
const useResourcesFromEnvironment = (
system?: System,
- existingFilter?: ResourceCondition,
+ existingSelector?: ResourceCondition,
) => {
const { data: envs = [] } = api.environment.bySystemId.useQuery(
system?.id ?? "",
@@ -37,15 +37,15 @@ const useResourcesFromEnvironment = (
);
const filter: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.And,
conditions: [
{
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.Or,
- conditions: envs.map((e) => e.resourceFilter).filter(isPresent),
+ conditions: envs.map((e) => e.resourceSelector).filter(isPresent),
},
- ...(existingFilter ? [existingFilter] : []),
+ ...(existingSelector ? [existingSelector] : []),
],
};
@@ -54,27 +54,27 @@ const useResourcesFromEnvironment = (
{ enabled: system != null, placeholderData: (prev) => prev },
);
- return { filter, resources: data?.items ?? [], isLoading };
+ return { filter: filter, resources: data?.items ?? [], isLoading };
};
const useResourcesWithSearch = (
system?: System,
- existingFilter?: ResourceCondition,
+ existingSelector?: ResourceCondition,
) => {
const [search, setSearch] = useState("");
const {
filter: environmentFilters,
resources,
isLoading: allResourcesLoading,
- } = useResourcesFromEnvironment(system, existingFilter);
+ } = useResourcesFromEnvironment(system, existingSelector);
const filterWithSearch: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.And,
conditions: [
environmentFilters,
{
- type: ResourceFilterType.Name,
+ type: ResourceConditionType.Name,
operator: ColumnOperator.Contains,
value: search,
},
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx
index d1e302616..a604c4068 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableTable.tsx
@@ -69,7 +69,7 @@ export const VariableTable: React.FC<{
value={search}
className="rounded-none rounded-t-lg border-none hover:ring-0 focus-visible:ring-0"
type="text"
- placeholder="Filter variables..."
+ placeholder="Search variables..."
onChange={(e) => setSearch(e.target.value)}
/>
@@ -266,7 +266,7 @@ export const VariableTable: React.FC<{
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableValueDropdown.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableValueDropdown.tsx
index 34e3e5d8b..2a00d1f35 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableValueDropdown.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/VariableValueDropdown.tsx
@@ -58,7 +58,7 @@ import {
const editVariableValueFormSchema = z.object({
value: z.union([z.string(), z.number(), z.boolean()]),
- resourceFilter: resourceCondition
+ resourceSelector: resourceCondition
.nullish()
.refine((data) => data == null || isValidResourceCondition(data), {
message: "Invalid resource condition",
@@ -148,10 +148,10 @@ const EditVariableValueDialog: React.FC<{
(
- Resource filter
+ Resource selector
form.setValue("resourceFilter", null)}
+ onClick={() => form.setValue("resourceSelector", null)}
>
- Clear filter
+ Clear selector
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/page.tsx
index f4675a742..0ed1aa5f3 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/page.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/page.tsx
@@ -8,7 +8,7 @@ import LZString from "lz-string";
import { isPresent } from "ts-is-present";
import {
- ResourceFilterType,
+ ResourceConditionType,
ResourceOperator,
} from "@ctrlplane/validators/resources";
@@ -49,12 +49,12 @@ export default async function VariablesPage(props: {
deployment.id,
);
- const systemResourcesFilter: ComparisonCondition = {
- type: ResourceFilterType.Comparison,
+ const systemResourcesCondition: ComparisonCondition = {
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.Or,
conditions: await api.environment
.bySystemId(deployment.systemId)
- .then((envs) => envs.map((e) => e.resourceFilter).filter(isPresent)),
+ .then((envs) => envs.map((e) => e.resourceSelector).filter(isPresent)),
};
const variablesPromises = variablesByDeployment.map(async (variable) => {
@@ -64,27 +64,27 @@ export default async function VariablesPage(props: {
const rest = variable.values.filter((v) => v.id !== defaultValue?.id);
const valuesPromises = rest.map(async (v) => {
- if (v.resourceFilter == null)
+ if (v.resourceSelector == null)
return {
...v,
resourceCount: 0,
resources: [],
- filterHash: "",
+ conditionHash: "",
};
- const filterHash = LZString.compressToEncodedURIComponent(
- JSON.stringify(v.resourceFilter),
+ const conditionHash = LZString.compressToEncodedURIComponent(
+ JSON.stringify(v.resourceSelector),
);
- const filter: ComparisonCondition = {
- type: ResourceFilterType.Comparison,
+ const condition: ComparisonCondition = {
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.And,
- conditions: [systemResourcesFilter, v.resourceFilter],
+ conditions: [systemResourcesCondition, v.resourceSelector],
};
const resources = await api.resource.byWorkspaceId.list({
workspaceId,
- filter,
+ filter: condition,
limit: 5,
});
@@ -92,28 +92,30 @@ export default async function VariablesPage(props: {
...v,
resourceCount: resources.total,
resources: resources.items,
- filterHash,
+ conditionHash,
};
});
const values = await Promise.all(valuesPromises);
if (defaultValue != null) {
- const restFilters = rest.map((v) => v.resourceFilter).filter(isPresent);
+ const restConditions = rest
+ .map((v) => v.resourceSelector)
+ .filter(isPresent);
const filter: ResourceCondition =
- restFilters.length === 0
- ? systemResourcesFilter
+ restConditions.length === 0
+ ? systemResourcesCondition
: {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.And,
conditions: [
- systemResourcesFilter,
+ systemResourcesCondition,
{
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.Or,
not: true,
- conditions: restFilters,
+ conditions: restConditions,
},
],
};
@@ -124,7 +126,7 @@ export default async function VariablesPage(props: {
limit: 5,
});
- const filterHash = LZString.compressToEncodedURIComponent(
+ const conditionHash = LZString.compressToEncodedURIComponent(
JSON.stringify(filter),
);
@@ -132,7 +134,7 @@ export default async function VariablesPage(props: {
...defaultValue,
resourceCount: defaultResources.total,
resources: defaultResources.items,
- filterHash,
+ conditionHash,
});
}
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/variable-data.ts b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/variable-data.ts
index 38770145a..efd0e83a8 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/variable-data.ts
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(sidebar)/variables/variable-data.ts
@@ -3,7 +3,7 @@ import type * as schema from "@ctrlplane/db/schema";
export type VariableValue = schema.DeploymentVariableValue & {
resources: schema.Resource[];
resourceCount: number;
- filterHash: string;
+ conditionHash: string;
};
export type VariableData = schema.DeploymentVariable & {
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/resources/ResourcesPageContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/resources/ResourcesPageContent.tsx
index 22289bd33..6aa9f562f 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/resources/ResourcesPageContent.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/resources/ResourcesPageContent.tsx
@@ -38,10 +38,10 @@ import { Skeleton } from "@ctrlplane/ui/skeleton";
import {
ColumnOperator,
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import {
- ResourceFilterType,
+ ResourceConditionType,
ResourceOperator,
} from "@ctrlplane/validators/resources";
@@ -77,7 +77,7 @@ const usePagination = (total: number) => {
return { page, setPage };
};
-const parseResourceFilter = (
+const parseResourceSelector = (
filter: ResourceCondition | null,
): ComparisonCondition | null => {
if (filter == null) return null;
@@ -96,7 +96,7 @@ const parseResourceFilter = (
const getResourceFilterFromDropdownChange = (
resourceFilter: ComparisonCondition | null,
value: string,
- type: ResourceFilterType.Kind | ResourceFilterType.Version,
+ type: ResourceConditionType.Kind | ResourceConditionType.Version,
): ComparisonCondition | null => {
if (value === "all") {
if (resourceFilter == null) return null;
@@ -116,7 +116,7 @@ const getResourceFilterFromDropdownChange = (
if (resourceFilter == null) {
return {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: false,
conditions: [condition],
@@ -128,13 +128,13 @@ const getResourceFilterFromDropdownChange = (
);
const newResourceFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: false,
conditions: [...conditionsExcludingType, condition],
};
- return parseResourceFilter(newResourceFilter);
+ return parseResourceSelector(newResourceFilter);
};
const getResourceFilterWithSearch = (
@@ -145,24 +145,24 @@ const getResourceFilterWithSearch = (
if (resourceFilter == null) return null;
const conditionsExcludingSearch = resourceFilter.conditions.filter(
- (c) => c.type !== ResourceFilterType.Name,
+ (c) => c.type !== ResourceConditionType.Name,
);
- return parseResourceFilter({
+ return parseResourceSelector({
...resourceFilter,
conditions: conditionsExcludingSearch,
});
}
const newNameCondition: ResourceCondition = {
- type: ResourceFilterType.Name,
+ type: ResourceConditionType.Name,
operator: ColumnOperator.Contains,
value: searchTerm,
};
if (resourceFilter == null) {
- return parseResourceFilter({
- type: FilterType.Comparison,
+ return parseResourceSelector({
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: false,
conditions: [newNameCondition],
@@ -170,10 +170,10 @@ const getResourceFilterWithSearch = (
}
const conditionsExcludingSearch = resourceFilter.conditions.filter(
- (c) => c.type !== ResourceFilterType.Name,
+ (c) => c.type !== ResourceConditionType.Name,
);
- return parseResourceFilter({
+ return parseResourceSelector({
...resourceFilter,
conditions: [...conditionsExcludingSearch, newNameCondition],
});
@@ -186,7 +186,7 @@ export const ResourcesPageContent: React.FC<{
const allResourcesQ = useFilteredResources(
workspaceId,
environment.id,
- environment.resourceFilter,
+ environment.resourceSelector,
);
const totalResources = allResourcesQ.resources.length;
@@ -212,10 +212,12 @@ export const ResourcesPageContent: React.FC<{
useState(null);
const finalFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: false,
- conditions: [environment.resourceFilter, resourceFilter].filter(isPresent),
+ conditions: [environment.resourceSelector, resourceFilter].filter(
+ isPresent,
+ ),
};
const { resources, isLoading } = useFilteredResources(
@@ -228,14 +230,14 @@ export const ResourcesPageContent: React.FC<{
const handleFilterDropdownChange = (
value: string,
- type: ResourceFilterType.Kind | ResourceFilterType.Version,
+ type: ResourceConditionType.Kind | ResourceConditionType.Version,
) => {
const newResourceFilter = getResourceFilterFromDropdownChange(
resourceFilter,
value,
type,
);
- setResourceFilter(parseResourceFilter(newResourceFilter));
+ setResourceFilter(parseResourceSelector(newResourceFilter));
};
const [search, setSearch] = useState("");
@@ -256,7 +258,7 @@ export const ResourcesPageContent: React.FC<{
.groupBy((t) => t.version + ": " + t.kind)
.value() as Record;
- if (environment.resourceFilter == null)
+ if (environment.resourceSelector == null)
return (
@@ -368,7 +370,7 @@ export const ResourcesPageContent: React.FC<{
- setResourceFilter(parseResourceFilter(condition))
+ setResourceFilter(parseResourceSelector(condition))
}
>
)}
{kinds.data?.map(({ version, kind, count }) => {
- const url = `/${workspace.slug}/resources/list?filter=${LZString.compressToEncodedURIComponent(
+ const url = `/${workspace.slug}/resources/list?condition=${LZString.compressToEncodedURIComponent(
JSON.stringify({
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [
{
- type: ResourceFilterType.Kind,
+ type: ResourceConditionType.Kind,
value: kind,
operator: "equals",
},
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/groupings/[groupId]/CombincationsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/groupings/[groupId]/CombincationsTable.tsx
index e74d8d34b..0369eaf45 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/groupings/[groupId]/CombincationsTable.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/groupings/[groupId]/CombincationsTable.tsx
@@ -14,6 +14,8 @@ import {
import { urls } from "~/app/urls";
+const CONDITION_PARAM = "condition";
+
export const CombinationsTable: React.FC<{
workspaceSlug: string;
combinations: Array<{
@@ -40,7 +42,7 @@ export const CombinationsTable: React.FC<{
className="cursor-pointer"
onClick={() => {
const query = new URLSearchParams(window.location.search);
- const filterHash = LZString.compressToEncodedURIComponent(
+ const conditionHash = LZString.compressToEncodedURIComponent(
JSON.stringify({
type: "comparison",
operator: "and",
@@ -55,7 +57,7 @@ export const CombinationsTable: React.FC<{
),
}),
);
- query.set("filter", filterHash);
+ query.set(CONDITION_PARAM, conditionHash);
return router.push(`${resourceListUrl}?${query.toString()}`);
}}
>
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/list/ResourcePageContent.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/list/ResourcePageContent.tsx
index 7ef1c4d2f..5a2fa9fba 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/list/ResourcePageContent.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/list/ResourcePageContent.tsx
@@ -31,7 +31,7 @@ import {
ResourceConditionDialog,
} from "~/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceConditionDialog";
import { ResourceViewActionsDropdown } from "~/app/[workspaceSlug]/(app)/_components/resources/condition/ResourceViewActionsDropdown";
-import { useResourceFilter } from "~/app/[workspaceSlug]/(app)/_components/resources/condition/useResourceFilter";
+import { useResourceCondition } from "~/app/[workspaceSlug]/(app)/_components/resources/condition/useResourceCondition";
import { api } from "~/trpc/react";
import { exportResources } from "./export-resources";
import { ResourceGettingStarted } from "./ResourceGettingStarted";
@@ -83,18 +83,18 @@ export const ResourcePageContent: React.FC<{
view: schema.ResourceView | null;
}> = ({ workspace, view }) => {
const [search, setSearch] = React.useState("");
- const { filter, setFilter } = useResourceFilter();
+ const { condition, setCondition } = useResourceCondition();
useDebounce(
() => {
if (search !== "") {
- setFilter({
+ setCondition({
type: "comparison",
operator: "and",
conditions: [
// Keep any non-name conditions from existing filter
- ...(filter && "conditions" in filter
- ? filter.conditions.filter(
+ ...(condition && "conditions" in condition
+ ? condition.conditions.filter(
(c: ResourceCondition) => c.type !== "name",
)
: []),
@@ -108,14 +108,14 @@ export const ResourcePageContent: React.FC<{
return;
}
- if (filter == null || !isComparisonCondition(filter)) return;
- const otherConditions = filter.conditions.filter(
+ if (condition == null || !isComparisonCondition(condition)) return;
+ const otherConditions = condition.conditions.filter(
(c: ResourceCondition) => c.type !== "name",
);
- setFilter(
+ setCondition(
otherConditions.length === 0
? null
- : { ...filter, conditions: otherConditions },
+ : { ...condition, conditions: otherConditions },
);
},
500,
@@ -128,13 +128,13 @@ export const ResourcePageContent: React.FC<{
limit: 0,
});
const resources = api.resource.byWorkspaceId.list.useQuery(
- { workspaceId, filter: filter ?? undefined, limit: 500 },
+ { workspaceId, filter: condition ?? undefined, limit: 500 },
{ placeholderData: (prev) => prev },
);
- const onFilterChange = (condition: ResourceCondition | null) => {
+ const onConditionChange = (condition: ResourceCondition | null) => {
const cond = condition ?? defaultCondition;
- setFilter(isEmptyCondition(cond) ? null : cond);
+ setCondition(isEmptyCondition(cond) ? null : cond);
};
const router = useRouter();
@@ -147,7 +147,10 @@ export const ResourcePageContent: React.FC<{
-
+
{view == null && (
)}
- {filter != null && view == null && (
-
+ {condition != null && view == null && (
+
)}
{view != null && (
<>
@@ -183,11 +186,11 @@ export const ResourcePageContent: React.FC<{
)}
- {filter != null && view == null && (
+ {condition != null && view == null && (
setFilter(v.filter, v.id)}
+ filter={condition}
+ onSubmit={(v) => setCondition(v.filter, v.id)}
>
Save view
@@ -232,7 +235,7 @@ export const ResourcePageContent: React.FC<{
setFilter(null)}
+ onClear={() => setCondition(null)}
/>
)}
{resources.data != null && resources.data.total > 0 && (
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx
index 9fc6af3bf..c1c55875b 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/page.tsx
@@ -37,7 +37,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@ctrlplane/ui/tooltip";
-import { ResourceFilterType } from "@ctrlplane/validators/resources";
+import { ResourceConditionType } from "@ctrlplane/validators/resources";
import { PageHeader } from "~/app/[workspaceSlug]/(app)/_components/PageHeader";
import { Sidebars } from "~/app/[workspaceSlug]/sidebars";
@@ -121,14 +121,16 @@ export default async function ResourceProvidersPage(props: {
);
const providers = resourceProviders.map((provider) => {
- const filter: ResourceCondition = {
- type: ResourceFilterType.Provider,
+ const condition: ResourceCondition = {
+ type: ResourceConditionType.Provider,
value: provider.id,
operator: "equals",
};
- const hash = LZString.compressToEncodedURIComponent(JSON.stringify(filter));
- const filterLink = `/${workspaceSlug}/resources/list?filter=${hash}`;
- return { ...provider, filterLink };
+ const hash = LZString.compressToEncodedURIComponent(
+ JSON.stringify(condition),
+ );
+ const conditionLink = `/${workspaceSlug}/resources/list?condition=${hash}`;
+ return { ...provider, filterLink: conditionLink };
});
const integrationsUrl = urls
diff --git a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/views/ResourceViewsTable.tsx b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/views/ResourceViewsTable.tsx
index 532dd2fdf..367a6fd54 100644
--- a/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/views/ResourceViewsTable.tsx
+++ b/apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/views/ResourceViewsTable.tsx
@@ -39,7 +39,7 @@ export const ResourceViewsTable: React.FC<{
key={view.id}
onClick={() =>
router.push(
- `/${workspace.slug}/resources?filter=${view.hash}&view=${view.id}`,
+ `/${workspace.slug}/resources?condition=${view.hash}&view=${view.id}`,
)
}
className="cursor-pointer"
diff --git a/apps/webservice/src/app/api/v1/deployments/openapi.ts b/apps/webservice/src/app/api/v1/deployments/openapi.ts
index 50453a70c..7c6c3c044 100644
--- a/apps/webservice/src/app/api/v1/deployments/openapi.ts
+++ b/apps/webservice/src/app/api/v1/deployments/openapi.ts
@@ -61,9 +61,9 @@ export const openapi: Swagger.SwaggerV3 = {
description: "The timeout for the deployment",
example: 60,
},
- resourceFilter: {
+ resourceSelector: {
type: "object",
- description: "The resource filter for the deployment",
+ description: "The resource selector for the deployment",
example: { key: "value" },
},
},
diff --git a/apps/webservice/src/app/api/v1/environments/openapi.ts b/apps/webservice/src/app/api/v1/environments/openapi.ts
index 895142753..e9db26d92 100644
--- a/apps/webservice/src/app/api/v1/environments/openapi.ts
+++ b/apps/webservice/src/app/api/v1/environments/openapi.ts
@@ -34,7 +34,7 @@ export const openapi: Swagger.SwaggerV3 = {
description: {
type: "string",
},
- resourceFilter: {
+ resourceSelector: {
type: "object",
additionalProperties: true,
},
diff --git a/apps/webservice/src/app/api/v1/openapi.ts b/apps/webservice/src/app/api/v1/openapi.ts
index 23aa91e39..adcce2fec 100644
--- a/apps/webservice/src/app/api/v1/openapi.ts
+++ b/apps/webservice/src/app/api/v1/openapi.ts
@@ -192,7 +192,7 @@ export const openapi: Swagger.SwaggerV3 = {
name: { type: "string" },
description: { type: "string" },
policyId: { type: "string", format: "uuid", nullable: true },
- resourceFilter: {
+ resourceSelector: {
type: "object",
nullable: true,
additionalProperties: true,
diff --git a/apps/webservice/src/app/api/v1/release-channels/openapi.ts b/apps/webservice/src/app/api/v1/release-channels/openapi.ts
index d743ac385..3b00a38a6 100644
--- a/apps/webservice/src/app/api/v1/release-channels/openapi.ts
+++ b/apps/webservice/src/app/api/v1/release-channels/openapi.ts
@@ -17,12 +17,12 @@ export const openapi: Swagger.SwaggerV3 = {
"application/json": {
schema: {
type: "object",
- required: ["deploymentId", "name", "releaseFilter"],
+ required: ["deploymentId", "name", "releaseSelector"],
properties: {
deploymentId: { type: "string" },
name: { type: "string" },
description: { type: "string", nullable: true },
- releaseFilter: {
+ releaseSelector: {
type: "object",
additionalProperties: true,
},
@@ -44,7 +44,7 @@ export const openapi: Swagger.SwaggerV3 = {
name: { type: "string" },
description: { type: "string", nullable: true },
createdAt: { type: "string", format: "date-time" },
- releaseFilter: {
+ releaseSelector: {
type: "object",
additionalProperties: true,
},
diff --git a/apps/webservice/src/app/api/v1/release-channels/route.ts b/apps/webservice/src/app/api/v1/release-channels/route.ts
index 64f1cc938..30b3528d4 100644
--- a/apps/webservice/src/app/api/v1/release-channels/route.ts
+++ b/apps/webservice/src/app/api/v1/release-channels/route.ts
@@ -12,7 +12,7 @@ import { parseBody } from "../body-parser";
import { request } from "../middleware";
const schema = createDeploymentVersionChannel.extend({
- releaseFilter: deploymentVersionCondition.optional(),
+ releaseSelector: deploymentVersionCondition.optional(),
});
export const POST = request()
@@ -26,7 +26,7 @@ export const POST = request()
),
)
.handle<{ body: z.infer }>(({ db, body }) => {
- const versionSelector = body.versionSelector ?? body.releaseFilter;
+ const versionSelector = body.versionSelector ?? body.releaseSelector;
return db
.insert(SCHEMA.deploymentVersionChannel)
diff --git a/apps/webservice/src/app/api/v1/workspaces/[workspaceId]/resources/[filter]/openapi.ts b/apps/webservice/src/app/api/v1/workspaces/[workspaceId]/resources/[filter]/openapi.ts
index ec9f64aab..9d1409305 100644
--- a/apps/webservice/src/app/api/v1/workspaces/[workspaceId]/resources/[filter]/openapi.ts
+++ b/apps/webservice/src/app/api/v1/workspaces/[workspaceId]/resources/[filter]/openapi.ts
@@ -37,7 +37,7 @@ export const openapi: Swagger.SwaggerV3 = {
},
},
"400": {
- description: "Invalid filter",
+ description: "Invalid selector",
content: {
"application/json": {
schema: {
diff --git a/openapi.v1.json b/openapi.v1.json
index fe6e0a788..84a850882 100644
--- a/openapi.v1.json
+++ b/openapi.v1.json
@@ -395,9 +395,9 @@
"description": "The timeout for the deployment",
"example": 60
},
- "resourceFilter": {
+ "resourceSelector": {
"type": "object",
- "description": "The resource filter for the deployment",
+ "description": "The resource selector for the deployment",
"example": {
"key": "value"
}
@@ -565,7 +565,7 @@
"description": {
"type": "string"
},
- "resourceFilter": {
+ "resourceSelector": {
"type": "object",
"additionalProperties": true
},
@@ -1258,7 +1258,7 @@
"required": [
"deploymentId",
"name",
- "releaseFilter"
+ "releaseSelector"
],
"properties": {
"deploymentId": {
@@ -1271,7 +1271,7 @@
"type": "string",
"nullable": true
},
- "releaseFilter": {
+ "releaseSelector": {
"type": "object",
"additionalProperties": true
}
@@ -1305,7 +1305,7 @@
"type": "string",
"format": "date-time"
},
- "releaseFilter": {
+ "releaseSelector": {
"type": "object",
"additionalProperties": true
}
@@ -2659,7 +2659,7 @@
}
},
"400": {
- "description": "Invalid filter",
+ "description": "Invalid selector",
"content": {
"application/json": {
"schema": {
@@ -3371,7 +3371,7 @@
"format": "uuid",
"nullable": true
},
- "resourceFilter": {
+ "resourceSelector": {
"type": "object",
"nullable": true,
"additionalProperties": true
diff --git a/packages/api/src/router/deployment-variable.ts b/packages/api/src/router/deployment-variable.ts
index 039dcfe72..9f926aa55 100644
--- a/packages/api/src/router/deployment-variable.ts
+++ b/packages/api/src/router/deployment-variable.ts
@@ -39,7 +39,7 @@ import {
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { createTRPCRouter, protectedProcedure } from "../trpc";
@@ -119,7 +119,9 @@ const valueRouter = createTRPCRouter({
with: {
system: {
with: {
- environments: { where: isNotNull(environment.resourceFilter) },
+ environments: {
+ where: isNotNull(environment.resourceSelector),
+ },
},
},
},
@@ -127,9 +129,9 @@ const valueRouter = createTRPCRouter({
.then((d) => d?.system.environments ?? []);
const systemCondition: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
- conditions: dep.map((e) => e.resourceFilter).filter(isPresent),
+ conditions: dep.map((e) => e.resourceSelector).filter(isPresent),
};
const updatedValue = await ctx.db.transaction((tx) =>
@@ -176,54 +178,58 @@ const valueRouter = createTRPCRouter({
),
);
- const getOldResourceFilter = (): ResourceCondition | null => {
- if (value.id !== variable.defaultValueId) return value.resourceFilter;
+ const getOldResourceSelector = (): ResourceCondition | null => {
+ if (value.id !== variable.defaultValueId) return value.resourceSelector;
const conditions = otherValues
- .map((v) => v.resourceFilter)
+ .map((v) => v.resourceSelector)
.filter(isPresent);
return {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
not: true,
conditions,
};
};
- const getNewResourceFilter = (): ResourceCondition | null => {
+ const getNewResourceSelector = (): ResourceCondition | null => {
if (updatedValue.id !== newDefaultValueId)
- return updatedValue.resourceFilter;
+ return updatedValue.resourceSelector;
const conditions = otherValues
- .map((v) => v.resourceFilter)
+ .map((v) => v.resourceSelector)
.filter(isPresent);
return {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
not: true,
conditions,
};
};
- const oldResourceFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ const oldResourceSelector: ResourceCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [systemCondition, getOldResourceFilter()].filter(isPresent),
+ conditions: [systemCondition, getOldResourceSelector()].filter(
+ isPresent,
+ ),
};
- const newResourceFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ const newResourceSelector: ResourceCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [systemCondition, getNewResourceFilter()].filter(isPresent),
+ conditions: [systemCondition, getNewResourceSelector()].filter(
+ isPresent,
+ ),
};
const oldResources = await ctx.db.query.resource.findMany({
where: and(
- resourceMatchesMetadata(ctx.db, oldResourceFilter),
+ resourceMatchesMetadata(ctx.db, oldResourceSelector),
isNull(resource.deletedAt),
),
});
const newResources = await ctx.db.query.resource.findMany({
where: and(
- resourceMatchesMetadata(ctx.db, newResourceFilter),
+ resourceMatchesMetadata(ctx.db, newResourceSelector),
isNull(resource.deletedAt),
),
});
@@ -287,7 +293,7 @@ const valueRouter = createTRPCRouter({
.mutation(async ({ ctx, input }) => {
// Note: Due to cascading deletes set up in the schema, this will also delete:
// - All deploymentVariableValueResource entries for this value
- // - All deploymentVariableValueResourceFilter entries for those resources
+ // - All deploymentVariableValueResourceSelector entries for those resources
return ctx.db
.delete(deploymentVariableValue)
@@ -329,7 +335,8 @@ export const deploymentVariableRouter = createTRPCRouter({
.groupBy((r) => r.deployment_variable.id)
.map((r) => ({
...r[0]!.deployment_variable,
- resourceFilter: r[0]!.deployment_variable_value.resourceFilter,
+ resourceSelector:
+ r[0]!.deployment_variable_value.resourceSelector,
value: r[0]!.deployment_variable_value,
deployment: { ...r[0]!.deployment, system: r[0]!.system },
}))
@@ -338,7 +345,7 @@ export const deploymentVariableRouter = createTRPCRouter({
return Promise.all(
deploymentVariables.map(async (deploymentVariable) => {
- const { resourceFilter } = deploymentVariable;
+ const { resourceSelector } = deploymentVariable;
const tg = await ctx.db
.select()
@@ -347,7 +354,7 @@ export const deploymentVariableRouter = createTRPCRouter({
and(
eq(resource.id, input),
isNull(resource.deletedAt),
- resourceMatchesMetadata(ctx.db, resourceFilter),
+ resourceMatchesMetadata(ctx.db, resourceSelector),
),
)
.then(takeFirstOrNull);
@@ -376,7 +383,7 @@ export const deploymentVariableRouter = createTRPCRouter({
id: deploymentVariableValue.id,
value: deploymentVariableValue.value,
variableId: deploymentVariableValue.variableId,
- resourceFilter: deploymentVariableValue.resourceFilter,
+ resourceSelector: deploymentVariableValue.resourceSelector,
})
.from(deploymentVariableValue)
.orderBy(asc(deploymentVariableValue.value))
@@ -394,7 +401,7 @@ export const deploymentVariableRouter = createTRPCRouter({
'id', ${deploymentVariableValueSubquery.id},
'value', ${deploymentVariableValueSubquery.value},
'variableId', ${deploymentVariableValueSubquery.variableId},
- 'resourceFilter', ${deploymentVariableValueSubquery.resourceFilter}
+ 'resourceSelector', ${deploymentVariableValueSubquery.resourceSelector}
)
else null end
) filter (where ${deploymentVariableValueSubquery.id} is not null),
diff --git a/packages/api/src/router/deployment-version.ts b/packages/api/src/router/deployment-version.ts
index 4aadd0aad..5dc76fc7a 100644
--- a/packages/api/src/router/deployment-version.ts
+++ b/packages/api/src/router/deployment-version.ts
@@ -30,7 +30,7 @@ import {
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import {
activeStatus,
@@ -205,7 +205,7 @@ export const versionRouter = createTRPCRouter({
.input(
z.object({
deploymentId: z.string(),
- selector: deploymentVersionCondition.optional(),
+ filter: deploymentVersionCondition.optional(),
jobFilter: jobCondition.optional(),
limit: z.number().nonnegative().default(100),
offset: z.number().nonnegative().default(0),
@@ -218,7 +218,7 @@ export const versionRouter = createTRPCRouter({
);
const versionSelectorCheck = SCHEMA.deploymentVersionMatchesCondition(
ctx.db,
- input.selector,
+ input.filter,
);
const checks = and(
...[deploymentIdCheck, versionSelectorCheck].filter(isPresent),
@@ -792,19 +792,19 @@ export const versionRouter = createTRPCRouter({
.where(eq(SCHEMA.deployment.id, deploymentId))
.then(takeFirst);
- if (env.environment.resourceFilter == null)
+ if (env.environment.resourceSelector == null)
return {
...version.deployment_version,
approval: version.environment_policy_approval,
resourceCount: 0,
};
- const resourceFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ const resourceSelector: ResourceCondition = {
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [
- env.environment.resourceFilter,
- dep.resourceFilter,
+ env.environment.resourceSelector,
+ dep.resourceSelector,
].filter(isPresent),
};
@@ -814,7 +814,7 @@ export const versionRouter = createTRPCRouter({
.where(
and(
eq(SCHEMA.resource.workspaceId, env.system.workspaceId),
- SCHEMA.resourceMatchesMetadata(ctx.db, resourceFilter),
+ SCHEMA.resourceMatchesMetadata(ctx.db, resourceSelector),
isNull(SCHEMA.resource.deletedAt),
),
)
diff --git a/packages/api/src/router/deployment.ts b/packages/api/src/router/deployment.ts
index 96c23987a..dbe033beb 100644
--- a/packages/api/src/router/deployment.ts
+++ b/packages/api/src/router/deployment.ts
@@ -502,7 +502,7 @@ export const deploymentRouter = createTRPCRouter({
.where(
and(
eq(SCHEMA.system.workspaceId, tg.workspaceId),
- isNotNull(SCHEMA.environment.resourceFilter),
+ isNotNull(SCHEMA.environment.resourceSelector),
),
);
@@ -527,7 +527,7 @@ export const deploymentRouter = createTRPCRouter({
SCHEMA.resource,
SCHEMA.resourceMatchesMetadata(
ctx.db,
- env.environment.resourceFilter,
+ env.environment.resourceSelector,
),
)
.leftJoin(
diff --git a/packages/api/src/router/environment-page/deployments/deployment-stats.ts b/packages/api/src/router/environment-page/deployments/deployment-stats.ts
index 436ceba83..4efc57ce7 100644
--- a/packages/api/src/router/environment-page/deployments/deployment-stats.ts
+++ b/packages/api/src/router/environment-page/deployments/deployment-stats.ts
@@ -7,7 +7,7 @@ import { and, desc, eq, inArray, isNull, takeFirstOrNull } from "@ctrlplane/db";
import * as SCHEMA from "@ctrlplane/db/schema";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import {
analyticsStatuses,
@@ -106,11 +106,12 @@ export const getDeploymentStats = async (
const versionSelector = await getVersionSelector(db, environment, deployment);
const resourceSelector: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [environment.resourceFilter, deployment.resourceFilter].filter(
- isPresent,
- ),
+ conditions: [
+ environment.resourceSelector,
+ deployment.resourceSelector,
+ ].filter(isPresent),
};
const row = await db
diff --git a/packages/api/src/router/environment-page/overview/deployment-stats.ts b/packages/api/src/router/environment-page/overview/deployment-stats.ts
index beb3eccdd..b87c73912 100644
--- a/packages/api/src/router/environment-page/overview/deployment-stats.ts
+++ b/packages/api/src/router/environment-page/overview/deployment-stats.ts
@@ -45,7 +45,7 @@ export const getDeploymentStats = async (
.where(
and(
inArray(SCHEMA.resource.id, resourceIds),
- SCHEMA.resourceMatchesMetadata(db, deployment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(db, deployment.resourceSelector),
),
)
.then((resources) => resources.map((r) => r.id));
@@ -73,7 +73,7 @@ export const getDeploymentStats = async (
eq(SCHEMA.releaseJobTrigger.environmentId, environment.id),
eq(SCHEMA.deploymentVersion.deploymentId, deployment.id),
inArray(SCHEMA.job.status, deployedStatuses),
- SCHEMA.resourceMatchesMetadata(db, deployment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(db, deployment.resourceSelector),
),
)
.orderBy(
diff --git a/packages/api/src/router/environment-page/overview/router.ts b/packages/api/src/router/environment-page/overview/router.ts
index f056d9c0b..ce721a251 100644
--- a/packages/api/src/router/environment-page/overview/router.ts
+++ b/packages/api/src/router/environment-page/overview/router.ts
@@ -8,7 +8,7 @@ import * as SCHEMA from "@ctrlplane/db/schema";
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { createTRPCRouter, protectedProcedure } from "../../../trpc";
@@ -43,7 +43,7 @@ export const overviewRouter = createTRPCRouter({
.from(SCHEMA.deployment)
.where(eq(SCHEMA.deployment.systemId, environment.systemId));
- if (environment.resourceFilter == null) {
+ if (environment.resourceSelector == null) {
return {
deployments: {
total: 0,
@@ -63,7 +63,10 @@ export const overviewRouter = createTRPCRouter({
.where(
and(
isNull(SCHEMA.resource.deletedAt),
- SCHEMA.resourceMatchesMetadata(ctx.db, environment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(
+ ctx.db,
+ environment.resourceSelector,
+ ),
eq(SCHEMA.resource.workspaceId, workspaceId),
),
);
@@ -125,14 +128,14 @@ export const overviewRouter = createTRPCRouter({
deploymentPromise,
]);
- if (environment.resourceFilter == null) return null;
+ if (environment.resourceSelector == null) return null;
const resourceSelector: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [
- environment.resourceFilter,
- deployment.resourceFilter,
+ environment.resourceSelector,
+ deployment.resourceSelector,
].filter(isPresent),
};
diff --git a/packages/api/src/router/environment-page/resources/router.ts b/packages/api/src/router/environment-page/resources/router.ts
index b0d7fdb37..fca818740 100644
--- a/packages/api/src/router/environment-page/resources/router.ts
+++ b/packages/api/src/router/environment-page/resources/router.ts
@@ -8,7 +8,7 @@ import * as SCHEMA from "@ctrlplane/db/schema";
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import {
activeStatus,
@@ -45,9 +45,9 @@ export const resourcesRouter = createTRPCRouter({
.then(takeFirst);
const selector: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [environment.resourceFilter, input.filter].filter(
+ conditions: [environment.resourceSelector, input.filter].filter(
isPresent,
),
};
diff --git a/packages/api/src/router/environment-stats.ts b/packages/api/src/router/environment-stats.ts
index 3b7a45977..582167ca2 100644
--- a/packages/api/src/router/environment-stats.ts
+++ b/packages/api/src/router/environment-stats.ts
@@ -35,7 +35,7 @@ export const environmentStatsRouter = createTRPCRouter({
.where(eq(SCHEMA.environment.id, input))
.then(takeFirstOrNull);
- if (environment?.resourceFilter == null) return [];
+ if (environment?.resourceSelector == null) return [];
const statusRankSubquery = ctx.db
.select({
@@ -89,7 +89,10 @@ export const environmentStatsRouter = createTRPCRouter({
.limit(1),
),
isNull(SCHEMA.resource.deletedAt),
- SCHEMA.resourceMatchesMetadata(ctx.db, environment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(
+ ctx.db,
+ environment.resourceSelector,
+ ),
),
);
}),
diff --git a/packages/api/src/router/environment.ts b/packages/api/src/router/environment.ts
index a1f9c1416..7ade0bf59 100644
--- a/packages/api/src/router/environment.ts
+++ b/packages/api/src/router/environment.ts
@@ -35,7 +35,7 @@ import {
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { createTRPCRouter, protectedProcedure } from "../trpc";
@@ -253,18 +253,18 @@ export const environmentRouter = createTRPCRouter({
.returning()
.then(takeFirst);
- const { resourceFilter } = input.data;
- const isUpdatingResourceFilter =
- resourceFilter != null || oldEnv.environment.resourceFilter != null;
- if (isUpdatingResourceFilter) {
- const hasResourceFiltersChanged = !_.isEqual(
- oldEnv.environment.resourceFilter,
- resourceFilter,
+ const { resourceSelector } = input.data;
+ const isUpdatingResourceSelector =
+ resourceSelector != null || oldEnv.environment.resourceSelector != null;
+ if (isUpdatingResourceSelector) {
+ const hasResourceSelectorsChanged = !_.isEqual(
+ oldEnv.environment.resourceSelector,
+ resourceSelector,
);
- if (hasResourceFiltersChanged) {
+ if (hasResourceSelectorsChanged) {
const isOtherEnv = and(
- isNotNull(environment.resourceFilter),
+ isNotNull(environment.resourceSelector),
ne(environment.id, input.id),
);
const sys = await ctx.db.query.system.findFirst({
@@ -273,14 +273,15 @@ export const environmentRouter = createTRPCRouter({
});
const otherEnvFilters =
- sys?.environments.map((e) => e.resourceFilter).filter(isPresent) ??
- [];
+ sys?.environments
+ .map((e) => e.resourceSelector)
+ .filter(isPresent) ?? [];
const oldQuery = resourceMatchesMetadata(
ctx.db,
- oldEnv.environment.resourceFilter,
+ oldEnv.environment.resourceSelector,
);
- const newQuery = resourceMatchesMetadata(ctx.db, resourceFilter);
+ const newQuery = resourceMatchesMetadata(ctx.db, resourceSelector);
const newResources =
newQuery != null
@@ -311,7 +312,7 @@ export const environmentRouter = createTRPCRouter({
if (removedResources.length > 0) {
const sysFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
not: true,
conditions: otherEnvFilters,
diff --git a/packages/api/src/router/job.ts b/packages/api/src/router/job.ts
index ea07e754b..f147f433a 100644
--- a/packages/api/src/router/job.ts
+++ b/packages/api/src/router/job.ts
@@ -394,7 +394,7 @@ const releaseJobTriggerRouter = createTRPCRouter({
.input(
z.object({
versionId: z.string().uuid(),
- filter: jobCondition.optional(),
+ condition: jobCondition.optional(),
limit: z.number().int().nonnegative().max(1000).default(500),
offset: z.number().int().nonnegative().default(0),
}),
@@ -420,7 +420,7 @@ const releaseJobTriggerRouter = createTRPCRouter({
and(
eq(schema.deploymentVersion.id, input.versionId),
isNull(schema.resource.deletedAt),
- schema.releaseJobMatchesCondition(ctx.db, input.filter),
+ schema.releaseJobMatchesCondition(ctx.db, input.condition),
),
)
.orderBy(desc(schema.releaseJobTrigger.createdAt))
diff --git a/packages/api/src/router/resource-stats.ts b/packages/api/src/router/resource-stats.ts
index 6de6c574d..b5a9b5e50 100644
--- a/packages/api/src/router/resource-stats.ts
+++ b/packages/api/src/router/resource-stats.ts
@@ -165,12 +165,12 @@ export const resourceStatsRouter = createTRPCRouter({
if (environment == null) throw new Error("Environment not found");
- if (environment.resourceFilter == null) return [];
+ if (environment.resourceSelector == null) return [];
const countPromises = getDateRangeCounts(
ctx.db,
dateRange(startDate, endDate, 1, "days"),
- SCHEMA.resourceMatchesMetadata(ctx.db, environment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(ctx.db, environment.resourceSelector),
);
return Promise.all(countPromises);
diff --git a/packages/api/src/router/resources.ts b/packages/api/src/router/resources.ts
index e0991db69..f3f6e4e18 100644
--- a/packages/api/src/router/resources.ts
+++ b/packages/api/src/router/resources.ts
@@ -75,13 +75,13 @@ const resourceQuery = (db: Tx, checks: Array>) =>
const environmentHasResource = (
db: Tx,
resourceId: string,
- resourceFilter: ResourceCondition,
+ resourceSelector: ResourceCondition,
) =>
db.query.resource
.findFirst({
where: and(
eq(schema.resource.id, resourceId),
- schema.resourceMatchesMetadata(db, resourceFilter),
+ schema.resourceMatchesMetadata(db, resourceSelector),
isNotDeleted,
),
})
@@ -172,7 +172,7 @@ const getNodeDataForResource = async (
resourceId: string,
jobId?: string,
) => {
- const hasFilter = isNotNull(schema.environment.resourceFilter);
+ const hasFilter = isNotNull(schema.environment.resourceSelector);
const resource = await db.query.resource.findFirst({
where: and(eq(schema.resource.id, resourceId), isNotDeleted),
with: {
@@ -202,9 +202,9 @@ const getNodeDataForResource = async (
const systemsWithResource = await _.chain(
systems.map(async (s) =>
_.chain(s.environments)
- .filter((e) => isPresent(e.resourceFilter))
+ .filter((e) => isPresent(e.resourceSelector))
.map((e) =>
- environmentHasResource(db, resource.id, e.resourceFilter!).then(
+ environmentHasResource(db, resource.id, e.resourceSelector!).then(
async (t) =>
t
? {
diff --git a/packages/api/src/router/system.ts b/packages/api/src/router/system.ts
index 709287301..f3bd30572 100644
--- a/packages/api/src/router/system.ts
+++ b/packages/api/src/router/system.ts
@@ -29,7 +29,7 @@ import {
import { Permission } from "@ctrlplane/validators/auth";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { createTRPCRouter, protectedProcedure } from "../trpc";
@@ -228,14 +228,14 @@ export const systemRouter = createTRPCRouter({
.where(
and(
eq(environment.systemId, input.systemId),
- isNotNull(environment.resourceFilter),
+ isNotNull(environment.resourceSelector),
),
);
const filter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
- conditions: envsWithFilter.map((env) => env.resourceFilter!),
+ conditions: envsWithFilter.map((env) => env.resourceSelector!),
};
const itemsPromise = ctx.db
diff --git a/packages/db/drizzle/0079_mute_cerise.sql b/packages/db/drizzle/0079_mute_cerise.sql
new file mode 100644
index 000000000..db65f6bd8
--- /dev/null
+++ b/packages/db/drizzle/0079_mute_cerise.sql
@@ -0,0 +1,4 @@
+ALTER TABLE "deployment_variable_value" RENAME COLUMN "resource_filter" TO "resource_selector";--> statement-breakpoint
+ALTER TABLE "deployment" RENAME COLUMN "resource_filter" TO "resource_selector";--> statement-breakpoint
+ALTER TABLE "environment" RENAME COLUMN "resource_filter" TO "resource_selector";--> statement-breakpoint
+ALTER TABLE "resource_view" RENAME COLUMN "filter" TO "selector";--> statement-breakpoint
\ No newline at end of file
diff --git a/packages/db/drizzle/0080_cuddly_mantis.sql b/packages/db/drizzle/0080_cuddly_mantis.sql
new file mode 100644
index 000000000..3d9fee7bb
--- /dev/null
+++ b/packages/db/drizzle/0080_cuddly_mantis.sql
@@ -0,0 +1 @@
+ALTER TABLE "resource_view" RENAME COLUMN "selector" TO "filter";
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0079_snapshot.json b/packages/db/drizzle/meta/0079_snapshot.json
new file mode 100644
index 000000000..cd234f473
--- /dev/null
+++ b/packages/db/drizzle/meta/0079_snapshot.json
@@ -0,0 +1,4557 @@
+{
+ "id": "5d6e7b03-f01d-4c64-a454-93b71ec2c4d0",
+ "prevId": "cb189498-cb33-4ffa-9674-425a38b5ce93",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "name": "account_provider_providerAccountId_pk",
+ "columns": ["provider", "providerAccountId"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_workspace_id": {
+ "name": "active_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "null"
+ },
+ "password_hash": {
+ "name": "password_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "null"
+ },
+ "system_role": {
+ "name": "system_role",
+ "type": "system_role",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_active_workspace_id_workspace_id_fk": {
+ "name": "user_active_workspace_id_workspace_id_fk",
+ "tableFrom": "user",
+ "tableTo": "workspace",
+ "columnsFrom": ["active_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_api_key": {
+ "name": "user_api_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_preview": {
+ "name": "key_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_prefix": {
+ "name": "key_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "user_api_key_key_prefix_key_hash_index": {
+ "name": "user_api_key_key_prefix_key_hash_index",
+ "columns": [
+ {
+ "expression": "key_prefix",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_api_key_user_id_user_id_fk": {
+ "name": "user_api_key_user_id_user_id_fk",
+ "tableFrom": "user_api_key",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.dashboard": {
+ "name": "dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "dashboard_workspace_id_workspace_id_fk": {
+ "name": "dashboard_workspace_id_workspace_id_fk",
+ "tableFrom": "dashboard",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.dashboard_widget": {
+ "name": "dashboard_widget",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "dashboard_id": {
+ "name": "dashboard_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "widget": {
+ "name": "widget",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "x": {
+ "name": "x",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "y": {
+ "name": "y",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "w": {
+ "name": "w",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "h": {
+ "name": "h",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "dashboard_widget_dashboard_id_dashboard_id_fk": {
+ "name": "dashboard_widget_dashboard_id_dashboard_id_fk",
+ "tableFrom": "dashboard_widget",
+ "tableTo": "dashboard",
+ "columnsFrom": ["dashboard_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable": {
+ "name": "deployment_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_value_id": {
+ "name": "default_value_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "schema": {
+ "name": "schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "deployment_variable_deployment_id_key_index": {
+ "name": "deployment_variable_deployment_id_key_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_deployment_id_deployment_id_fk": {
+ "name": "deployment_variable_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_variable",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_variable_default_value_id_deployment_variable_value_id_fk": {
+ "name": "deployment_variable_default_value_id_deployment_variable_value_id_fk",
+ "tableFrom": "deployment_variable",
+ "tableTo": "deployment_variable_value",
+ "columnsFrom": ["default_value_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable_set": {
+ "name": "deployment_variable_set",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "deployment_variable_set_deployment_id_variable_set_id_index": {
+ "name": "deployment_variable_set_deployment_id_variable_set_id_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "variable_set_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_set_deployment_id_deployment_id_fk": {
+ "name": "deployment_variable_set_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_variable_set",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_variable_set_variable_set_id_variable_set_id_fk": {
+ "name": "deployment_variable_set_variable_set_id_variable_set_id_fk",
+ "tableFrom": "deployment_variable_set",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable_value": {
+ "name": "deployment_variable_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_id": {
+ "name": "variable_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_variable_value_variable_id_value_index": {
+ "name": "deployment_variable_value_variable_id_value_index",
+ "columns": [
+ {
+ "expression": "variable_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "value",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_value_variable_id_deployment_variable_id_fk": {
+ "name": "deployment_variable_value_variable_id_deployment_variable_id_fk",
+ "tableFrom": "deployment_variable_value",
+ "tableTo": "deployment_variable",
+ "columnsFrom": ["variable_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version": {
+ "name": "deployment_version",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag": {
+ "name": "tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "deployment_version_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ready'"
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "deployment_version_deployment_id_tag_index": {
+ "name": "deployment_version_deployment_id_tag_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tag",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "deployment_version_created_at_idx": {
+ "name": "deployment_version_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_channel": {
+ "name": "deployment_version_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_selector": {
+ "name": "deployment_version_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_version_channel_deployment_id_name_index": {
+ "name": "deployment_version_channel_deployment_id_name_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_channel_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_channel_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version_channel",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_metadata": {
+ "name": "deployment_version_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "deployment_version_metadata_key_deployment_version_id_index": {
+ "name": "deployment_version_metadata_key_deployment_version_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_metadata_deployment_version_id_deployment_version_id_fk": {
+ "name": "deployment_version_metadata_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "deployment_version_metadata",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_dependency": {
+ "name": "deployment_version_dependency",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_selector": {
+ "name": "deployment_version_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_version_dependency_deployment_version_id_deployment_id_index": {
+ "name": "deployment_version_dependency_deployment_version_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_dependency_deployment_version_id_deployment_version_id_fk": {
+ "name": "deployment_version_dependency_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "deployment_version_dependency",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_version_dependency_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_dependency_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment": {
+ "name": "deployment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "retry_count": {
+ "name": "retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_system_id_slug_index": {
+ "name": "deployment_system_id_slug_index",
+ "columns": [
+ {
+ "expression": "system_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_system_id_system_id_fk": {
+ "name": "deployment_system_id_system_id_fk",
+ "tableFrom": "deployment",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "deployment_job_agent_id_job_agent_id_fk": {
+ "name": "deployment_job_agent_id_job_agent_id_fk",
+ "tableFrom": "deployment",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_meta_dependency": {
+ "name": "deployment_meta_dependency",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "depends_on_id": {
+ "name": "depends_on_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "deployment_meta_dependency_depends_on_id_deployment_id_index": {
+ "name": "deployment_meta_dependency_depends_on_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "depends_on_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_meta_dependency_deployment_id_deployment_id_fk": {
+ "name": "deployment_meta_dependency_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_meta_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "deployment_meta_dependency_depends_on_id_deployment_id_fk": {
+ "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk",
+ "tableFrom": "deployment_meta_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["depends_on_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_deployment": {
+ "name": "environment_policy_deployment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_policy_deployment_policy_id_environment_id_index": {
+ "name": "environment_policy_deployment_policy_id_environment_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_deployment_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_deployment_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_deployment",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_environment_id_environment_id_fk": {
+ "name": "environment_policy_deployment_environment_id_environment_id_fk",
+ "tableFrom": "environment_policy_deployment",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment": {
+ "name": "environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "directory": {
+ "name": "directory",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_system_id_name_index": {
+ "name": "environment_system_id_name_index",
+ "columns": [
+ {
+ "expression": "system_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_system_id_system_id_fk": {
+ "name": "environment_system_id_system_id_fk",
+ "tableFrom": "environment",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_metadata": {
+ "name": "environment_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_metadata_key_environment_id_index": {
+ "name": "environment_metadata_key_environment_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_metadata_environment_id_environment_id_fk": {
+ "name": "environment_metadata_environment_id_environment_id_fk",
+ "tableFrom": "environment_metadata",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy": {
+ "name": "environment_policy",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_required": {
+ "name": "approval_required",
+ "type": "environment_policy_approval_requirement",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'automatic'"
+ },
+ "success_status": {
+ "name": "success_status",
+ "type": "environment_policy_deployment_success_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "minimum_success": {
+ "name": "minimum_success",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "concurrency_limit": {
+ "name": "concurrency_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "rollout_duration": {
+ "name": "rollout_duration",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "minimum_release_interval": {
+ "name": "minimum_release_interval",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "release_sequencing": {
+ "name": "release_sequencing",
+ "type": "release_sequencing_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cancel'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "environment_policy_system_id_system_id_fk": {
+ "name": "environment_policy_system_id_system_id_fk",
+ "tableFrom": "environment_policy",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_environment_id_environment_id_fk": {
+ "name": "environment_policy_environment_id_environment_id_fk",
+ "tableFrom": "environment_policy",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_approval": {
+ "name": "environment_policy_approval",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "release_id": {
+ "name": "release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "approval_status_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "environment_policy_approval_policy_id_release_id_index": {
+ "name": "environment_policy_approval_policy_id_release_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "release_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_approval_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_approval_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_approval_release_id_deployment_version_id_fk": {
+ "name": "environment_policy_approval_release_id_deployment_version_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_approval_user_id_user_id_fk": {
+ "name": "environment_policy_approval_user_id_user_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_release_window": {
+ "name": "environment_policy_release_window",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recurrence": {
+ "name": "recurrence",
+ "type": "recurrence_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "environment_policy_release_window_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_release_window_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_release_window",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.event": {
+ "name": "event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.hook": {
+ "name": "hook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runhook": {
+ "name": "runhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "hook_id": {
+ "name": "hook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "runhook_hook_id_runbook_id_index": {
+ "name": "runhook_hook_id_runbook_id_index",
+ "columns": [
+ {
+ "expression": "hook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "runbook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "runhook_hook_id_hook_id_fk": {
+ "name": "runhook_hook_id_hook_id_fk",
+ "tableFrom": "runhook",
+ "tableTo": "hook",
+ "columnsFrom": ["hook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runhook_runbook_id_runbook_id_fk": {
+ "name": "runhook_runbook_id_runbook_id_fk",
+ "tableFrom": "runhook",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.github_entity": {
+ "name": "github_entity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "github_entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'organization'"
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "added_by_user_id": {
+ "name": "added_by_user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "avatar_url": {
+ "name": "avatar_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_installation_workspace": {
+ "name": "unique_installation_workspace",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_entity_added_by_user_id_user_id_fk": {
+ "name": "github_entity_added_by_user_id_user_id_fk",
+ "tableFrom": "github_entity",
+ "tableTo": "user",
+ "columnsFrom": ["added_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "github_entity_workspace_id_workspace_id_fk": {
+ "name": "github_entity_workspace_id_workspace_id_fk",
+ "tableFrom": "github_entity",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.github_user": {
+ "name": "github_user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_user_id": {
+ "name": "github_user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_username": {
+ "name": "github_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_user_user_id_user_id_fk": {
+ "name": "github_user_user_id_user_id_fk",
+ "tableFrom": "github_user",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_resource_relationship": {
+ "name": "job_resource_relationship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_identifier": {
+ "name": "resource_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "job_resource_relationship_job_id_resource_identifier_index": {
+ "name": "job_resource_relationship_job_id_resource_identifier_index",
+ "columns": [
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_resource_relationship_job_id_job_id_fk": {
+ "name": "job_resource_relationship_job_id_job_id_fk",
+ "tableFrom": "job_resource_relationship",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource": {
+ "name": "resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "resource_identifier_workspace_id_index": {
+ "name": "resource_identifier_workspace_id_index",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "resource_workspace_id_workspace_id_fk": {
+ "name": "resource_workspace_id_workspace_id_fk",
+ "tableFrom": "resource",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_metadata": {
+ "name": "resource_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_metadata_key_resource_id_index": {
+ "name": "resource_metadata_key_resource_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_metadata_resource_id_resource_id_fk": {
+ "name": "resource_metadata_resource_id_resource_id_fk",
+ "tableFrom": "resource_metadata",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_relationship": {
+ "name": "resource_relationship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_identifier": {
+ "name": "from_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_identifier": {
+ "name": "to_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "resource_relationship_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_relationship_to_identifier_from_identifier_index": {
+ "name": "resource_relationship_to_identifier_from_identifier_index",
+ "columns": [
+ {
+ "expression": "to_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "from_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_relationship_workspace_id_workspace_id_fk": {
+ "name": "resource_relationship_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_relationship",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_schema": {
+ "name": "resource_schema",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "json_schema": {
+ "name": "json_schema",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_schema_version_kind_workspace_id_index": {
+ "name": "resource_schema_version_kind_workspace_id_index",
+ "columns": [
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_schema_workspace_id_workspace_id_fk": {
+ "name": "resource_schema_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_schema",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_variable": {
+ "name": "resource_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "resource_variable_resource_id_key_index": {
+ "name": "resource_variable_resource_id_key_index",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_variable_resource_id_resource_id_fk": {
+ "name": "resource_variable_resource_id_resource_id_fk",
+ "tableFrom": "resource_variable",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_view": {
+ "name": "resource_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "selector": {
+ "name": "selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_view_workspace_id_workspace_id_fk": {
+ "name": "resource_view_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_view",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.azure_tenant": {
+ "name": "azure_tenant",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "azure_tenant_tenant_id_index": {
+ "name": "azure_tenant_tenant_id_index",
+ "columns": [
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "azure_tenant_workspace_id_workspace_id_fk": {
+ "name": "azure_tenant_workspace_id_workspace_id_fk",
+ "tableFrom": "azure_tenant",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider": {
+ "name": "resource_provider",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "resource_provider_workspace_id_name_index": {
+ "name": "resource_provider_workspace_id_name_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_provider_workspace_id_workspace_id_fk": {
+ "name": "resource_provider_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_provider",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_aws": {
+ "name": "resource_provider_aws",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "aws_role_arns": {
+ "name": "aws_role_arns",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "import_eks": {
+ "name": "import_eks",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vpc": {
+ "name": "import_vpc",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_aws_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_aws_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_aws",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_azure": {
+ "name": "resource_provider_azure",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_azure_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_azure_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_azure",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "resource_provider_azure_tenant_id_azure_tenant_id_fk": {
+ "name": "resource_provider_azure_tenant_id_azure_tenant_id_fk",
+ "tableFrom": "resource_provider_azure",
+ "tableTo": "azure_tenant",
+ "columnsFrom": ["tenant_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_google": {
+ "name": "resource_provider_google",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_ids": {
+ "name": "project_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "import_gke": {
+ "name": "import_gke",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_namespaces": {
+ "name": "import_namespaces",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vcluster": {
+ "name": "import_vcluster",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vms": {
+ "name": "import_vms",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vpc": {
+ "name": "import_vpc",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_google_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_google_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_google",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.system": {
+ "name": "system",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "system_workspace_id_slug_index": {
+ "name": "system_workspace_id_slug_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "system_workspace_id_workspace_id_fk": {
+ "name": "system_workspace_id_workspace_id_fk",
+ "tableFrom": "system",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook": {
+ "name": "runbook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "runbook_system_id_system_id_fk": {
+ "name": "runbook_system_id_system_id_fk",
+ "tableFrom": "runbook",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runbook_job_agent_id_job_agent_id_fk": {
+ "name": "runbook_job_agent_id_job_agent_id_fk",
+ "tableFrom": "runbook",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook_job_trigger": {
+ "name": "runbook_job_trigger",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "runbook_job_trigger_job_id_job_id_fk": {
+ "name": "runbook_job_trigger_job_id_job_id_fk",
+ "tableFrom": "runbook_job_trigger",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runbook_job_trigger_runbook_id_runbook_id_fk": {
+ "name": "runbook_job_trigger_runbook_id_runbook_id_fk",
+ "tableFrom": "runbook_job_trigger",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "runbook_job_trigger_job_id_unique": {
+ "name": "runbook_job_trigger_job_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["job_id"]
+ }
+ }
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "team_member_team_id_user_id_index": {
+ "name": "team_member_team_id_user_id_index",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job": {
+ "name": "job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "job_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "job_reason",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'policy_passing'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "job_created_at_idx": {
+ "name": "job_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_status_idx": {
+ "name": "job_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_job_agent_id_job_agent_id_fk": {
+ "name": "job_job_agent_id_job_agent_id_fk",
+ "tableFrom": "job",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_metadata": {
+ "name": "job_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "job_metadata_key_job_id_index": {
+ "name": "job_metadata_key_job_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_metadata_job_id_job_id_fk": {
+ "name": "job_metadata_job_id_job_id_fk",
+ "tableFrom": "job_metadata",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_variable": {
+ "name": "job_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "job_variable_job_id_key_index": {
+ "name": "job_variable_job_id_key_index",
+ "columns": [
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_variable_job_id_job_id_fk": {
+ "name": "job_variable_job_id_job_id_fk",
+ "tableFrom": "job_variable",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "google_service_account_email": {
+ "name": "google_service_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aws_role_arn": {
+ "name": "aws_role_arn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ }
+ },
+ "public.workspace_email_domain_matching": {
+ "name": "workspace_email_domain_matching",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verified": {
+ "name": "verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "verification_code": {
+ "name": "verification_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verification_email": {
+ "name": "verification_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_email_domain_matching_workspace_id_domain_index": {
+ "name": "workspace_email_domain_matching_workspace_id_domain_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_email_domain_matching_workspace_id_workspace_id_fk": {
+ "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_email_domain_matching",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_email_domain_matching_role_id_role_id_fk": {
+ "name": "workspace_email_domain_matching_role_id_role_id_fk",
+ "tableFrom": "workspace_email_domain_matching",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set": {
+ "name": "variable_set",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "variable_set_system_id_system_id_fk": {
+ "name": "variable_set_system_id_system_id_fk",
+ "tableFrom": "variable_set",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set_environment": {
+ "name": "variable_set_environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "variable_set_environment_variable_set_id_variable_set_id_fk": {
+ "name": "variable_set_environment_variable_set_id_variable_set_id_fk",
+ "tableFrom": "variable_set_environment",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "variable_set_environment_environment_id_environment_id_fk": {
+ "name": "variable_set_environment_environment_id_environment_id_fk",
+ "tableFrom": "variable_set_environment",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set_value": {
+ "name": "variable_set_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "variable_set_value_variable_set_id_key_index": {
+ "name": "variable_set_value_variable_set_id_key_index",
+ "columns": [
+ {
+ "expression": "variable_set_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "variable_set_value_variable_set_id_variable_set_id_fk": {
+ "name": "variable_set_value_variable_set_id_variable_set_id_fk",
+ "tableFrom": "variable_set_value",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.workspace_invite_token": {
+ "name": "workspace_invite_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_invite_token_role_id_role_id_fk": {
+ "name": "workspace_invite_token_role_id_role_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_token_workspace_id_workspace_id_fk": {
+ "name": "workspace_invite_token_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_token_created_by_user_id_fk": {
+ "name": "workspace_invite_token_created_by_user_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_invite_token_token_unique": {
+ "name": "workspace_invite_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ }
+ },
+ "public.resource_metadata_group": {
+ "name": "resource_metadata_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keys": {
+ "name": "keys",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "include_null_combinations": {
+ "name": "include_null_combinations",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_metadata_group_workspace_id_workspace_id_fk": {
+ "name": "resource_metadata_group_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_metadata_group",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook_variable": {
+ "name": "runbook_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema": {
+ "name": "schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "required": {
+ "name": "required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "runbook_variable_runbook_id_key_index": {
+ "name": "runbook_variable_runbook_id_key_index",
+ "columns": [
+ {
+ "expression": "runbook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "runbook_variable_runbook_id_runbook_id_fk": {
+ "name": "runbook_variable_runbook_id_runbook_id_fk",
+ "tableFrom": "runbook_variable",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.entity_role": {
+ "name": "entity_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "scope_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": {
+ "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index",
+ "columns": [
+ {
+ "expression": "role_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "entity_role_role_id_role_id_fk": {
+ "name": "entity_role_role_id_role_id_fk",
+ "tableFrom": "entity_role",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.role": {
+ "name": "role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "role_workspace_id_workspace_id_fk": {
+ "name": "role_workspace_id_workspace_id_fk",
+ "tableFrom": "role",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.role_permission": {
+ "name": "role_permission",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "role_permission_role_id_permission_index": {
+ "name": "role_permission_role_id_permission_index",
+ "columns": [
+ {
+ "expression": "role_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "role_permission_role_id_role_id_fk": {
+ "name": "role_permission_role_id_role_id_fk",
+ "tableFrom": "role_permission",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_agent": {
+ "name": "job_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ }
+ },
+ "indexes": {
+ "job_agent_workspace_id_name_index": {
+ "name": "job_agent_workspace_id_name_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_agent_workspace_id_workspace_id_fk": {
+ "name": "job_agent_workspace_id_workspace_id_fk",
+ "tableFrom": "job_agent",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_deployment_version_channel": {
+ "name": "environment_policy_deployment_version_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_policy_deployment_version_channel_policy_id_channel_id_index": {
+ "name": "environment_policy_deployment_version_channel_policy_id_channel_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environment_policy_deployment_version_channel_policy_id_deployment_id_index": {
+ "name": "environment_policy_deployment_version_channel_policy_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk": {
+ "name": "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "deployment_version_channel",
+ "columnsFrom": ["channel_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk": {
+ "name": "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.release_job_trigger": {
+ "name": "release_job_trigger",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "release_job_trigger_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caused_by_id": {
+ "name": "caused_by_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "release_job_trigger_job_id_job_id_fk": {
+ "name": "release_job_trigger_job_id_job_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_caused_by_id_user_id_fk": {
+ "name": "release_job_trigger_caused_by_id_user_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "user",
+ "columnsFrom": ["caused_by_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_deployment_version_id_deployment_version_id_fk": {
+ "name": "release_job_trigger_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_resource_id_resource_id_fk": {
+ "name": "release_job_trigger_resource_id_resource_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_environment_id_environment_id_fk": {
+ "name": "release_job_trigger_environment_id_environment_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "release_job_trigger_job_id_unique": {
+ "name": "release_job_trigger_job_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["job_id"]
+ }
+ }
+ }
+ },
+ "enums": {
+ "public.system_role": {
+ "name": "system_role",
+ "schema": "public",
+ "values": ["user", "admin"]
+ },
+ "public.deployment_version_status": {
+ "name": "deployment_version_status",
+ "schema": "public",
+ "values": ["building", "ready", "failed"]
+ },
+ "public.environment_policy_approval_requirement": {
+ "name": "environment_policy_approval_requirement",
+ "schema": "public",
+ "values": ["manual", "automatic"]
+ },
+ "public.approval_status_type": {
+ "name": "approval_status_type",
+ "schema": "public",
+ "values": ["pending", "approved", "rejected"]
+ },
+ "public.environment_policy_deployment_success_type": {
+ "name": "environment_policy_deployment_success_type",
+ "schema": "public",
+ "values": ["all", "some", "optional"]
+ },
+ "public.recurrence_type": {
+ "name": "recurrence_type",
+ "schema": "public",
+ "values": ["hourly", "daily", "weekly", "monthly"]
+ },
+ "public.release_sequencing_type": {
+ "name": "release_sequencing_type",
+ "schema": "public",
+ "values": ["wait", "cancel"]
+ },
+ "public.github_entity_type": {
+ "name": "github_entity_type",
+ "schema": "public",
+ "values": ["organization", "user"]
+ },
+ "public.resource_relationship_type": {
+ "name": "resource_relationship_type",
+ "schema": "public",
+ "values": ["associated_with", "depends_on"]
+ },
+ "public.job_reason": {
+ "name": "job_reason",
+ "schema": "public",
+ "values": [
+ "policy_passing",
+ "policy_override",
+ "env_policy_override",
+ "config_policy_override"
+ ]
+ },
+ "public.job_status": {
+ "name": "job_status",
+ "schema": "public",
+ "values": [
+ "cancelled",
+ "skipped",
+ "in_progress",
+ "action_required",
+ "pending",
+ "failure",
+ "invalid_job_agent",
+ "invalid_integration",
+ "external_run_not_found",
+ "successful"
+ ]
+ },
+ "public.entity_type": {
+ "name": "entity_type",
+ "schema": "public",
+ "values": ["user", "team"]
+ },
+ "public.scope_type": {
+ "name": "scope_type",
+ "schema": "public",
+ "values": [
+ "deploymentVersion",
+ "deploymentVersionChannel",
+ "resource",
+ "resourceProvider",
+ "resourceMetadataGroup",
+ "workspace",
+ "environment",
+ "environmentPolicy",
+ "deploymentVariable",
+ "variableSet",
+ "system",
+ "deployment",
+ "job",
+ "jobAgent",
+ "runbook",
+ "resourceView"
+ ]
+ },
+ "public.release_job_trigger_type": {
+ "name": "release_job_trigger_type",
+ "schema": "public",
+ "values": [
+ "new_version",
+ "version_updated",
+ "new_resource",
+ "resource_changed",
+ "api",
+ "redeploy",
+ "force_deploy",
+ "new_environment",
+ "variable_changed",
+ "retry"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/drizzle/meta/0080_snapshot.json b/packages/db/drizzle/meta/0080_snapshot.json
new file mode 100644
index 000000000..994652eab
--- /dev/null
+++ b/packages/db/drizzle/meta/0080_snapshot.json
@@ -0,0 +1,4557 @@
+{
+ "id": "63a50e7a-8302-4cf8-ad03-30f5aa42948f",
+ "prevId": "5d6e7b03-f01d-4c64-a454-93b71ec2c4d0",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "name": "account_provider_providerAccountId_pk",
+ "columns": ["provider", "providerAccountId"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "image": {
+ "name": "image",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_workspace_id": {
+ "name": "active_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "null"
+ },
+ "password_hash": {
+ "name": "password_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "null"
+ },
+ "system_role": {
+ "name": "system_role",
+ "type": "system_role",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_active_workspace_id_workspace_id_fk": {
+ "name": "user_active_workspace_id_workspace_id_fk",
+ "tableFrom": "user",
+ "tableTo": "workspace",
+ "columnsFrom": ["active_workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.user_api_key": {
+ "name": "user_api_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_preview": {
+ "name": "key_preview",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_prefix": {
+ "name": "key_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "user_api_key_key_prefix_key_hash_index": {
+ "name": "user_api_key_key_prefix_key_hash_index",
+ "columns": [
+ {
+ "expression": "key_prefix",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_api_key_user_id_user_id_fk": {
+ "name": "user_api_key_user_id_user_id_fk",
+ "tableFrom": "user_api_key",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.dashboard": {
+ "name": "dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "dashboard_workspace_id_workspace_id_fk": {
+ "name": "dashboard_workspace_id_workspace_id_fk",
+ "tableFrom": "dashboard",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.dashboard_widget": {
+ "name": "dashboard_widget",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "dashboard_id": {
+ "name": "dashboard_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "widget": {
+ "name": "widget",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "x": {
+ "name": "x",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "y": {
+ "name": "y",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "w": {
+ "name": "w",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "h": {
+ "name": "h",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "dashboard_widget_dashboard_id_dashboard_id_fk": {
+ "name": "dashboard_widget_dashboard_id_dashboard_id_fk",
+ "tableFrom": "dashboard_widget",
+ "tableTo": "dashboard",
+ "columnsFrom": ["dashboard_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable": {
+ "name": "deployment_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_value_id": {
+ "name": "default_value_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "schema": {
+ "name": "schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "deployment_variable_deployment_id_key_index": {
+ "name": "deployment_variable_deployment_id_key_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_deployment_id_deployment_id_fk": {
+ "name": "deployment_variable_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_variable",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_variable_default_value_id_deployment_variable_value_id_fk": {
+ "name": "deployment_variable_default_value_id_deployment_variable_value_id_fk",
+ "tableFrom": "deployment_variable",
+ "tableTo": "deployment_variable_value",
+ "columnsFrom": ["default_value_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable_set": {
+ "name": "deployment_variable_set",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "deployment_variable_set_deployment_id_variable_set_id_index": {
+ "name": "deployment_variable_set_deployment_id_variable_set_id_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "variable_set_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_set_deployment_id_deployment_id_fk": {
+ "name": "deployment_variable_set_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_variable_set",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_variable_set_variable_set_id_variable_set_id_fk": {
+ "name": "deployment_variable_set_variable_set_id_variable_set_id_fk",
+ "tableFrom": "deployment_variable_set",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_variable_value": {
+ "name": "deployment_variable_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_id": {
+ "name": "variable_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_variable_value_variable_id_value_index": {
+ "name": "deployment_variable_value_variable_id_value_index",
+ "columns": [
+ {
+ "expression": "variable_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "value",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_variable_value_variable_id_deployment_variable_id_fk": {
+ "name": "deployment_variable_value_variable_id_deployment_variable_id_fk",
+ "tableFrom": "deployment_variable_value",
+ "tableTo": "deployment_variable",
+ "columnsFrom": ["variable_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version": {
+ "name": "deployment_version",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag": {
+ "name": "tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "deployment_version_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ready'"
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "deployment_version_deployment_id_tag_index": {
+ "name": "deployment_version_deployment_id_tag_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tag",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "deployment_version_created_at_idx": {
+ "name": "deployment_version_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_channel": {
+ "name": "deployment_version_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_selector": {
+ "name": "deployment_version_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_version_channel_deployment_id_name_index": {
+ "name": "deployment_version_channel_deployment_id_name_index",
+ "columns": [
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_channel_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_channel_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version_channel",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_metadata": {
+ "name": "deployment_version_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "deployment_version_metadata_key_deployment_version_id_index": {
+ "name": "deployment_version_metadata_key_deployment_version_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_metadata_deployment_version_id_deployment_version_id_fk": {
+ "name": "deployment_version_metadata_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "deployment_version_metadata",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_version_dependency": {
+ "name": "deployment_version_dependency",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_version_selector": {
+ "name": "deployment_version_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_version_dependency_deployment_version_id_deployment_id_index": {
+ "name": "deployment_version_dependency_deployment_version_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "deployment_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_version_dependency_deployment_version_id_deployment_version_id_fk": {
+ "name": "deployment_version_dependency_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "deployment_version_dependency",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "deployment_version_dependency_deployment_id_deployment_id_fk": {
+ "name": "deployment_version_dependency_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_version_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment": {
+ "name": "deployment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "retry_count": {
+ "name": "retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "timeout": {
+ "name": "timeout",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "deployment_system_id_slug_index": {
+ "name": "deployment_system_id_slug_index",
+ "columns": [
+ {
+ "expression": "system_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_system_id_system_id_fk": {
+ "name": "deployment_system_id_system_id_fk",
+ "tableFrom": "deployment",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "deployment_job_agent_id_job_agent_id_fk": {
+ "name": "deployment_job_agent_id_job_agent_id_fk",
+ "tableFrom": "deployment",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.deployment_meta_dependency": {
+ "name": "deployment_meta_dependency",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "depends_on_id": {
+ "name": "depends_on_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "deployment_meta_dependency_depends_on_id_deployment_id_index": {
+ "name": "deployment_meta_dependency_depends_on_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "depends_on_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "deployment_meta_dependency_deployment_id_deployment_id_fk": {
+ "name": "deployment_meta_dependency_deployment_id_deployment_id_fk",
+ "tableFrom": "deployment_meta_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "deployment_meta_dependency_depends_on_id_deployment_id_fk": {
+ "name": "deployment_meta_dependency_depends_on_id_deployment_id_fk",
+ "tableFrom": "deployment_meta_dependency",
+ "tableTo": "deployment",
+ "columnsFrom": ["depends_on_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_deployment": {
+ "name": "environment_policy_deployment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_policy_deployment_policy_id_environment_id_index": {
+ "name": "environment_policy_deployment_policy_id_environment_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_deployment_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_deployment_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_deployment",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_environment_id_environment_id_fk": {
+ "name": "environment_policy_deployment_environment_id_environment_id_fk",
+ "tableFrom": "environment_policy_deployment",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment": {
+ "name": "environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "directory": {
+ "name": "directory",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_selector": {
+ "name": "resource_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_system_id_name_index": {
+ "name": "environment_system_id_name_index",
+ "columns": [
+ {
+ "expression": "system_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_system_id_system_id_fk": {
+ "name": "environment_system_id_system_id_fk",
+ "tableFrom": "environment",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_metadata": {
+ "name": "environment_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_metadata_key_environment_id_index": {
+ "name": "environment_metadata_key_environment_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_metadata_environment_id_environment_id_fk": {
+ "name": "environment_metadata_environment_id_environment_id_fk",
+ "tableFrom": "environment_metadata",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy": {
+ "name": "environment_policy",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_required": {
+ "name": "approval_required",
+ "type": "environment_policy_approval_requirement",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'automatic'"
+ },
+ "success_status": {
+ "name": "success_status",
+ "type": "environment_policy_deployment_success_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "minimum_success": {
+ "name": "minimum_success",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "concurrency_limit": {
+ "name": "concurrency_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ },
+ "rollout_duration": {
+ "name": "rollout_duration",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "minimum_release_interval": {
+ "name": "minimum_release_interval",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "release_sequencing": {
+ "name": "release_sequencing",
+ "type": "release_sequencing_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cancel'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "environment_policy_system_id_system_id_fk": {
+ "name": "environment_policy_system_id_system_id_fk",
+ "tableFrom": "environment_policy",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_environment_id_environment_id_fk": {
+ "name": "environment_policy_environment_id_environment_id_fk",
+ "tableFrom": "environment_policy",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_approval": {
+ "name": "environment_policy_approval",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "release_id": {
+ "name": "release_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "approval_status_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "NULL"
+ }
+ },
+ "indexes": {
+ "environment_policy_approval_policy_id_release_id_index": {
+ "name": "environment_policy_approval_policy_id_release_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "release_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_approval_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_approval_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_approval_release_id_deployment_version_id_fk": {
+ "name": "environment_policy_approval_release_id_deployment_version_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["release_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_approval_user_id_user_id_fk": {
+ "name": "environment_policy_approval_user_id_user_id_fk",
+ "tableFrom": "environment_policy_approval",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_release_window": {
+ "name": "environment_policy_release_window",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp (0) with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recurrence": {
+ "name": "recurrence",
+ "type": "recurrence_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "environment_policy_release_window_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_release_window_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_release_window",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.event": {
+ "name": "event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.hook": {
+ "name": "hook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runhook": {
+ "name": "runhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "hook_id": {
+ "name": "hook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "runhook_hook_id_runbook_id_index": {
+ "name": "runhook_hook_id_runbook_id_index",
+ "columns": [
+ {
+ "expression": "hook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "runbook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "runhook_hook_id_hook_id_fk": {
+ "name": "runhook_hook_id_hook_id_fk",
+ "tableFrom": "runhook",
+ "tableTo": "hook",
+ "columnsFrom": ["hook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runhook_runbook_id_runbook_id_fk": {
+ "name": "runhook_runbook_id_runbook_id_fk",
+ "tableFrom": "runhook",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.github_entity": {
+ "name": "github_entity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "github_entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'organization'"
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "added_by_user_id": {
+ "name": "added_by_user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "avatar_url": {
+ "name": "avatar_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_installation_workspace": {
+ "name": "unique_installation_workspace",
+ "columns": [
+ {
+ "expression": "installation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "github_entity_added_by_user_id_user_id_fk": {
+ "name": "github_entity_added_by_user_id_user_id_fk",
+ "tableFrom": "github_entity",
+ "tableTo": "user",
+ "columnsFrom": ["added_by_user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "github_entity_workspace_id_workspace_id_fk": {
+ "name": "github_entity_workspace_id_workspace_id_fk",
+ "tableFrom": "github_entity",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.github_user": {
+ "name": "github_user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_user_id": {
+ "name": "github_user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "github_username": {
+ "name": "github_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_user_user_id_user_id_fk": {
+ "name": "github_user_user_id_user_id_fk",
+ "tableFrom": "github_user",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_resource_relationship": {
+ "name": "job_resource_relationship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_identifier": {
+ "name": "resource_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "job_resource_relationship_job_id_resource_identifier_index": {
+ "name": "job_resource_relationship_job_id_resource_identifier_index",
+ "columns": [
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_resource_relationship_job_id_job_id_fk": {
+ "name": "job_resource_relationship_job_id_job_id_fk",
+ "tableFrom": "job_resource_relationship",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource": {
+ "name": "resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "resource_identifier_workspace_id_index": {
+ "name": "resource_identifier_workspace_id_index",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "resource_workspace_id_workspace_id_fk": {
+ "name": "resource_workspace_id_workspace_id_fk",
+ "tableFrom": "resource",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_metadata": {
+ "name": "resource_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_metadata_key_resource_id_index": {
+ "name": "resource_metadata_key_resource_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_metadata_resource_id_resource_id_fk": {
+ "name": "resource_metadata_resource_id_resource_id_fk",
+ "tableFrom": "resource_metadata",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_relationship": {
+ "name": "resource_relationship",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_identifier": {
+ "name": "from_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_identifier": {
+ "name": "to_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "resource_relationship_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_relationship_to_identifier_from_identifier_index": {
+ "name": "resource_relationship_to_identifier_from_identifier_index",
+ "columns": [
+ {
+ "expression": "to_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "from_identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_relationship_workspace_id_workspace_id_fk": {
+ "name": "resource_relationship_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_relationship",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_schema": {
+ "name": "resource_schema",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "json_schema": {
+ "name": "json_schema",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "resource_schema_version_kind_workspace_id_index": {
+ "name": "resource_schema_version_kind_workspace_id_index",
+ "columns": [
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_schema_workspace_id_workspace_id_fk": {
+ "name": "resource_schema_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_schema",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_variable": {
+ "name": "resource_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "resource_variable_resource_id_key_index": {
+ "name": "resource_variable_resource_id_key_index",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_variable_resource_id_resource_id_fk": {
+ "name": "resource_variable_resource_id_resource_id_fk",
+ "tableFrom": "resource_variable",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_view": {
+ "name": "resource_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "''"
+ },
+ "filter": {
+ "name": "filter",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_view_workspace_id_workspace_id_fk": {
+ "name": "resource_view_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_view",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.azure_tenant": {
+ "name": "azure_tenant",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "azure_tenant_tenant_id_index": {
+ "name": "azure_tenant_tenant_id_index",
+ "columns": [
+ {
+ "expression": "tenant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "azure_tenant_workspace_id_workspace_id_fk": {
+ "name": "azure_tenant_workspace_id_workspace_id_fk",
+ "tableFrom": "azure_tenant",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider": {
+ "name": "resource_provider",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "resource_provider_workspace_id_name_index": {
+ "name": "resource_provider_workspace_id_name_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "resource_provider_workspace_id_workspace_id_fk": {
+ "name": "resource_provider_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_provider",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_aws": {
+ "name": "resource_provider_aws",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "aws_role_arns": {
+ "name": "aws_role_arns",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "import_eks": {
+ "name": "import_eks",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vpc": {
+ "name": "import_vpc",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_aws_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_aws_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_aws",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_azure": {
+ "name": "resource_provider_azure",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_azure_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_azure_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_azure",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "resource_provider_azure_tenant_id_azure_tenant_id_fk": {
+ "name": "resource_provider_azure_tenant_id_azure_tenant_id_fk",
+ "tableFrom": "resource_provider_azure",
+ "tableTo": "azure_tenant",
+ "columnsFrom": ["tenant_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.resource_provider_google": {
+ "name": "resource_provider_google",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "resource_provider_id": {
+ "name": "resource_provider_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_ids": {
+ "name": "project_ids",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "import_gke": {
+ "name": "import_gke",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_namespaces": {
+ "name": "import_namespaces",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vcluster": {
+ "name": "import_vcluster",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vms": {
+ "name": "import_vms",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "import_vpc": {
+ "name": "import_vpc",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_provider_google_resource_provider_id_resource_provider_id_fk": {
+ "name": "resource_provider_google_resource_provider_id_resource_provider_id_fk",
+ "tableFrom": "resource_provider_google",
+ "tableTo": "resource_provider",
+ "columnsFrom": ["resource_provider_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.system": {
+ "name": "system",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "system_workspace_id_slug_index": {
+ "name": "system_workspace_id_slug_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "system_workspace_id_workspace_id_fk": {
+ "name": "system_workspace_id_workspace_id_fk",
+ "tableFrom": "system",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook": {
+ "name": "runbook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "runbook_system_id_system_id_fk": {
+ "name": "runbook_system_id_system_id_fk",
+ "tableFrom": "runbook",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runbook_job_agent_id_job_agent_id_fk": {
+ "name": "runbook_job_agent_id_job_agent_id_fk",
+ "tableFrom": "runbook",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook_job_trigger": {
+ "name": "runbook_job_trigger",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "runbook_job_trigger_job_id_job_id_fk": {
+ "name": "runbook_job_trigger_job_id_job_id_fk",
+ "tableFrom": "runbook_job_trigger",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "runbook_job_trigger_runbook_id_runbook_id_fk": {
+ "name": "runbook_job_trigger_runbook_id_runbook_id_fk",
+ "tableFrom": "runbook_job_trigger",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "runbook_job_trigger_job_id_unique": {
+ "name": "runbook_job_trigger_job_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["job_id"]
+ }
+ }
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "team_member_team_id_user_id_index": {
+ "name": "team_member_team_id_user_id_index",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job": {
+ "name": "job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_agent_id": {
+ "name": "job_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_agent_config": {
+ "name": "job_agent_config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "job_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "job_reason",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'policy_passing'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "job_created_at_idx": {
+ "name": "job_created_at_idx",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "job_status_idx": {
+ "name": "job_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_job_agent_id_job_agent_id_fk": {
+ "name": "job_job_agent_id_job_agent_id_fk",
+ "tableFrom": "job",
+ "tableTo": "job_agent",
+ "columnsFrom": ["job_agent_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_metadata": {
+ "name": "job_metadata",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "job_metadata_key_job_id_index": {
+ "name": "job_metadata_key_job_id_index",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_metadata_job_id_job_id_fk": {
+ "name": "job_metadata_job_id_job_id_fk",
+ "tableFrom": "job_metadata",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_variable": {
+ "name": "job_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sensitive": {
+ "name": "sensitive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "job_variable_job_id_key_index": {
+ "name": "job_variable_job_id_key_index",
+ "columns": [
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_variable_job_id_job_id_fk": {
+ "name": "job_variable_job_id_job_id_fk",
+ "tableFrom": "job_variable",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "google_service_account_email": {
+ "name": "google_service_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aws_role_arn": {
+ "name": "aws_role_arn",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ }
+ },
+ "public.workspace_email_domain_matching": {
+ "name": "workspace_email_domain_matching",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verified": {
+ "name": "verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "verification_code": {
+ "name": "verification_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verification_email": {
+ "name": "verification_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_email_domain_matching_workspace_id_domain_index": {
+ "name": "workspace_email_domain_matching_workspace_id_domain_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_email_domain_matching_workspace_id_workspace_id_fk": {
+ "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_email_domain_matching",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_email_domain_matching_role_id_role_id_fk": {
+ "name": "workspace_email_domain_matching_role_id_role_id_fk",
+ "tableFrom": "workspace_email_domain_matching",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set": {
+ "name": "variable_set",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "system_id": {
+ "name": "system_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "variable_set_system_id_system_id_fk": {
+ "name": "variable_set_system_id_system_id_fk",
+ "tableFrom": "variable_set",
+ "tableTo": "system",
+ "columnsFrom": ["system_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set_environment": {
+ "name": "variable_set_environment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "variable_set_environment_variable_set_id_variable_set_id_fk": {
+ "name": "variable_set_environment_variable_set_id_variable_set_id_fk",
+ "tableFrom": "variable_set_environment",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "variable_set_environment_environment_id_environment_id_fk": {
+ "name": "variable_set_environment_environment_id_environment_id_fk",
+ "tableFrom": "variable_set_environment",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.variable_set_value": {
+ "name": "variable_set_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "variable_set_id": {
+ "name": "variable_set_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "variable_set_value_variable_set_id_key_index": {
+ "name": "variable_set_value_variable_set_id_key_index",
+ "columns": [
+ {
+ "expression": "variable_set_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "variable_set_value_variable_set_id_variable_set_id_fk": {
+ "name": "variable_set_value_variable_set_id_variable_set_id_fk",
+ "tableFrom": "variable_set_value",
+ "tableTo": "variable_set",
+ "columnsFrom": ["variable_set_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.workspace_invite_token": {
+ "name": "workspace_invite_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_invite_token_role_id_role_id_fk": {
+ "name": "workspace_invite_token_role_id_role_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_token_workspace_id_workspace_id_fk": {
+ "name": "workspace_invite_token_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_invite_token_created_by_user_id_fk": {
+ "name": "workspace_invite_token_created_by_user_id_fk",
+ "tableFrom": "workspace_invite_token",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_invite_token_token_unique": {
+ "name": "workspace_invite_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ }
+ },
+ "public.resource_metadata_group": {
+ "name": "resource_metadata_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keys": {
+ "name": "keys",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "include_null_combinations": {
+ "name": "include_null_combinations",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "resource_metadata_group_workspace_id_workspace_id_fk": {
+ "name": "resource_metadata_group_workspace_id_workspace_id_fk",
+ "tableFrom": "resource_metadata_group",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.runbook_variable": {
+ "name": "runbook_variable",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "runbook_id": {
+ "name": "runbook_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema": {
+ "name": "schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "required": {
+ "name": "required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "runbook_variable_runbook_id_key_index": {
+ "name": "runbook_variable_runbook_id_key_index",
+ "columns": [
+ {
+ "expression": "runbook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "runbook_variable_runbook_id_runbook_id_fk": {
+ "name": "runbook_variable_runbook_id_runbook_id_fk",
+ "tableFrom": "runbook_variable",
+ "tableTo": "runbook",
+ "columnsFrom": ["runbook_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.entity_role": {
+ "name": "entity_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "entity_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "scope_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": {
+ "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index",
+ "columns": [
+ {
+ "expression": "role_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "entity_role_role_id_role_id_fk": {
+ "name": "entity_role_role_id_role_id_fk",
+ "tableFrom": "entity_role",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.role": {
+ "name": "role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "role_workspace_id_workspace_id_fk": {
+ "name": "role_workspace_id_workspace_id_fk",
+ "tableFrom": "role",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.role_permission": {
+ "name": "role_permission",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "role_permission_role_id_permission_index": {
+ "name": "role_permission_role_id_permission_index",
+ "columns": [
+ {
+ "expression": "role_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "role_permission_role_id_role_id_fk": {
+ "name": "role_permission_role_id_role_id_fk",
+ "tableFrom": "role_permission",
+ "tableTo": "role",
+ "columnsFrom": ["role_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.job_agent": {
+ "name": "job_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ }
+ },
+ "indexes": {
+ "job_agent_workspace_id_name_index": {
+ "name": "job_agent_workspace_id_name_index",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "job_agent_workspace_id_workspace_id_fk": {
+ "name": "job_agent_workspace_id_workspace_id_fk",
+ "tableFrom": "job_agent",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.environment_policy_deployment_version_channel": {
+ "name": "environment_policy_deployment_version_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deployment_id": {
+ "name": "deployment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "environment_policy_deployment_version_channel_policy_id_channel_id_index": {
+ "name": "environment_policy_deployment_version_channel_policy_id_channel_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "channel_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "environment_policy_deployment_version_channel_policy_id_deployment_id_index": {
+ "name": "environment_policy_deployment_version_channel_policy_id_deployment_id_index",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deployment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk": {
+ "name": "environment_policy_deployment_version_channel_policy_id_environment_policy_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "environment_policy",
+ "columnsFrom": ["policy_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk": {
+ "name": "environment_policy_deployment_version_channel_channel_id_deployment_version_channel_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "deployment_version_channel",
+ "columnsFrom": ["channel_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk": {
+ "name": "environment_policy_deployment_version_channel_deployment_id_deployment_id_fk",
+ "tableFrom": "environment_policy_deployment_version_channel",
+ "tableTo": "deployment",
+ "columnsFrom": ["deployment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "public.release_job_trigger": {
+ "name": "release_job_trigger",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "release_job_trigger_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caused_by_id": {
+ "name": "caused_by_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deployment_version_id": {
+ "name": "deployment_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "release_job_trigger_job_id_job_id_fk": {
+ "name": "release_job_trigger_job_id_job_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "job",
+ "columnsFrom": ["job_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_caused_by_id_user_id_fk": {
+ "name": "release_job_trigger_caused_by_id_user_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "user",
+ "columnsFrom": ["caused_by_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_deployment_version_id_deployment_version_id_fk": {
+ "name": "release_job_trigger_deployment_version_id_deployment_version_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "deployment_version",
+ "columnsFrom": ["deployment_version_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_resource_id_resource_id_fk": {
+ "name": "release_job_trigger_resource_id_resource_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "resource",
+ "columnsFrom": ["resource_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "release_job_trigger_environment_id_environment_id_fk": {
+ "name": "release_job_trigger_environment_id_environment_id_fk",
+ "tableFrom": "release_job_trigger",
+ "tableTo": "environment",
+ "columnsFrom": ["environment_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "release_job_trigger_job_id_unique": {
+ "name": "release_job_trigger_job_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["job_id"]
+ }
+ }
+ }
+ },
+ "enums": {
+ "public.system_role": {
+ "name": "system_role",
+ "schema": "public",
+ "values": ["user", "admin"]
+ },
+ "public.deployment_version_status": {
+ "name": "deployment_version_status",
+ "schema": "public",
+ "values": ["building", "ready", "failed"]
+ },
+ "public.environment_policy_approval_requirement": {
+ "name": "environment_policy_approval_requirement",
+ "schema": "public",
+ "values": ["manual", "automatic"]
+ },
+ "public.approval_status_type": {
+ "name": "approval_status_type",
+ "schema": "public",
+ "values": ["pending", "approved", "rejected"]
+ },
+ "public.environment_policy_deployment_success_type": {
+ "name": "environment_policy_deployment_success_type",
+ "schema": "public",
+ "values": ["all", "some", "optional"]
+ },
+ "public.recurrence_type": {
+ "name": "recurrence_type",
+ "schema": "public",
+ "values": ["hourly", "daily", "weekly", "monthly"]
+ },
+ "public.release_sequencing_type": {
+ "name": "release_sequencing_type",
+ "schema": "public",
+ "values": ["wait", "cancel"]
+ },
+ "public.github_entity_type": {
+ "name": "github_entity_type",
+ "schema": "public",
+ "values": ["organization", "user"]
+ },
+ "public.resource_relationship_type": {
+ "name": "resource_relationship_type",
+ "schema": "public",
+ "values": ["associated_with", "depends_on"]
+ },
+ "public.job_reason": {
+ "name": "job_reason",
+ "schema": "public",
+ "values": [
+ "policy_passing",
+ "policy_override",
+ "env_policy_override",
+ "config_policy_override"
+ ]
+ },
+ "public.job_status": {
+ "name": "job_status",
+ "schema": "public",
+ "values": [
+ "cancelled",
+ "skipped",
+ "in_progress",
+ "action_required",
+ "pending",
+ "failure",
+ "invalid_job_agent",
+ "invalid_integration",
+ "external_run_not_found",
+ "successful"
+ ]
+ },
+ "public.entity_type": {
+ "name": "entity_type",
+ "schema": "public",
+ "values": ["user", "team"]
+ },
+ "public.scope_type": {
+ "name": "scope_type",
+ "schema": "public",
+ "values": [
+ "deploymentVersion",
+ "deploymentVersionChannel",
+ "resource",
+ "resourceProvider",
+ "resourceMetadataGroup",
+ "workspace",
+ "environment",
+ "environmentPolicy",
+ "deploymentVariable",
+ "variableSet",
+ "system",
+ "deployment",
+ "job",
+ "jobAgent",
+ "runbook",
+ "resourceView"
+ ]
+ },
+ "public.release_job_trigger_type": {
+ "name": "release_job_trigger_type",
+ "schema": "public",
+ "values": [
+ "new_version",
+ "version_updated",
+ "new_resource",
+ "resource_changed",
+ "api",
+ "redeploy",
+ "force_deploy",
+ "new_environment",
+ "variable_changed",
+ "retry"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 26eaf09a2..a5974a378 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -554,6 +554,20 @@
"when": 1742170391401,
"tag": "0078_wandering_morph",
"breakpoints": true
+ },
+ {
+ "idx": 79,
+ "version": "7",
+ "when": 1742945347998,
+ "tag": "0079_mute_cerise",
+ "breakpoints": true
+ },
+ {
+ "idx": 80,
+ "version": "7",
+ "when": 1743004826960,
+ "tag": "0080_cuddly_mantis",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/src/schema/deployment-variables.ts b/packages/db/src/schema/deployment-variables.ts
index 83ddda7cc..455307470 100644
--- a/packages/db/src/schema/deployment-variables.ts
+++ b/packages/db/src/schema/deployment-variables.ts
@@ -60,7 +60,7 @@ export const deploymentVariableValue = pgTable(
id: uuid("id").notNull().primaryKey().defaultRandom(),
variableId: uuid("variable_id").notNull(),
value: jsonb("value").$type().notNull(),
- resourceFilter: jsonb("resource_filter")
+ resourceSelector: jsonb("resource_selector")
.$type()
.default(sql`NULL`),
},
@@ -79,7 +79,7 @@ export type DeploymentVariableValue = InferSelectModel<
>;
export const createDeploymentVariableValue = createInsertSchema(
deploymentVariableValue,
- { resourceFilter: resourceCondition },
+ { resourceSelector: resourceCondition },
)
.omit({
id: true,
diff --git a/packages/db/src/schema/deployment.ts b/packages/db/src/schema/deployment.ts
index fb5dc68bf..1d0234351 100644
--- a/packages/db/src/schema/deployment.ts
+++ b/packages/db/src/schema/deployment.ts
@@ -52,10 +52,12 @@ export const deploymentSchema = z.object({
.refine((val) => val == null || val >= 0, {
message: "Timeout must be a non-negative number.",
}),
- resourceFilter: resourceCondition
+ resourceSelector: resourceCondition
.nullable()
.optional()
- .refine((filter) => filter == null || isValidResourceCondition(filter)),
+ .refine(
+ (selector) => selector == null || isValidResourceCondition(selector),
+ ),
});
export const deployment = pgTable(
@@ -77,7 +79,7 @@ export const deployment = pgTable(
.notNull(),
retryCount: integer("retry_count").notNull().default(0),
timeout: integer("timeout").default(sql`NULL`),
- resourceFilter: jsonb("resource_filter")
+ resourceSelector: jsonb("resource_selector")
.$type()
.default(sql`NULL`),
},
diff --git a/packages/db/src/schema/environment.ts b/packages/db/src/schema/environment.ts
index 4470cb170..93fddf667 100644
--- a/packages/db/src/schema/environment.ts
+++ b/packages/db/src/schema/environment.ts
@@ -57,7 +57,7 @@ export const environment = pgTable(
directory: text("directory").notNull().default(""),
description: text("description").default(""),
policyId: uuid("policy_id").notNull(),
- resourceFilter: jsonb("resource_filter")
+ resourceSelector: jsonb("resource_selector")
.$type()
.default(sql`NULL`),
createdAt: timestamp("created_at", { withTimezone: true })
@@ -76,9 +76,11 @@ export const environment = pgTable(
export type Environment = InferSelectModel;
export const createEnvironment = createInsertSchema(environment, {
- resourceFilter: resourceCondition
+ resourceSelector: resourceCondition
.optional()
- .refine((filter) => filter == null || isValidResourceCondition(filter)),
+ .refine(
+ (selector) => selector == null || isValidResourceCondition(selector),
+ ),
})
.omit({ id: true, policyId: true })
.extend({
diff --git a/packages/db/src/schema/job.ts b/packages/db/src/schema/job.ts
index 917d116f3..a9bda7a3b 100644
--- a/packages/db/src/schema/job.ts
+++ b/packages/db/src/schema/job.ts
@@ -38,11 +38,11 @@ import { createInsertSchema } from "drizzle-zod";
import {
ColumnOperator,
ComparisonOperator,
+ ConditionType,
DateOperator,
- FilterType,
MetadataOperator,
} from "@ctrlplane/validators/conditions";
-import { JobFilterType } from "@ctrlplane/validators/jobs";
+import { JobConditionType } from "@ctrlplane/validators/jobs";
import type { Tx } from "../common.js";
import { deploymentVersion } from "./deployment-version.js";
@@ -252,18 +252,19 @@ const buildVersionCondition = (cond: VersionCondition): SQL => {
};
const buildCondition = (tx: Tx, cond: JobCondition): SQL => {
- if (cond.type === FilterType.Metadata)
+ if (cond.type === ConditionType.Metadata)
return buildMetadataCondition(tx, cond);
- if (cond.type === FilterType.CreatedAt) return buildCreatedAtCondition(cond);
- if (cond.type === JobFilterType.Status) return eq(job.status, cond.value);
- if (cond.type === JobFilterType.Deployment)
+ if (cond.type === ConditionType.CreatedAt)
+ return buildCreatedAtCondition(cond);
+ if (cond.type === JobConditionType.Status) return eq(job.status, cond.value);
+ if (cond.type === JobConditionType.Deployment)
return eq(deploymentVersion.deploymentId, cond.value);
- if (cond.type === JobFilterType.Environment)
+ if (cond.type === JobConditionType.Environment)
return eq(releaseJobTrigger.environmentId, cond.value);
- if (cond.type === FilterType.Version) return buildVersionCondition(cond);
- if (cond.type === JobFilterType.JobResource)
+ if (cond.type === ConditionType.Version) return buildVersionCondition(cond);
+ if (cond.type === JobConditionType.JobResource)
return and(eq(resource.id, cond.value), isNull(resource.deletedAt))!;
- if (cond.type === JobFilterType.Release)
+ if (cond.type === JobConditionType.Release)
return eq(deploymentVersion.id, cond.value);
const subCon = cond.conditions.map((c) => buildCondition(tx, c));
@@ -274,17 +275,18 @@ const buildCondition = (tx: Tx, cond: JobCondition): SQL => {
const buildRunbookCondition = (tx: Tx, cond: JobCondition): SQL | undefined => {
if (
- cond.type !== FilterType.Metadata &&
- cond.type !== FilterType.CreatedAt &&
- cond.type !== JobFilterType.Status &&
- cond.type !== FilterType.Comparison
+ cond.type !== ConditionType.Metadata &&
+ cond.type !== ConditionType.CreatedAt &&
+ cond.type !== JobConditionType.Status &&
+ cond.type !== ConditionType.Comparison
)
return undefined;
- if (cond.type === FilterType.Metadata)
+ if (cond.type === ConditionType.Metadata)
return buildMetadataCondition(tx, cond);
- if (cond.type === FilterType.CreatedAt) return buildCreatedAtCondition(cond);
- if (cond.type === JobFilterType.Status) return eq(job.status, cond.value);
+ if (cond.type === ConditionType.CreatedAt)
+ return buildCreatedAtCondition(cond);
+ if (cond.type === JobConditionType.Status) return eq(job.status, cond.value);
const subCon = cond.conditions.map((c) => buildCondition(tx, c));
const con =
diff --git a/packages/db/src/schema/resource.ts b/packages/db/src/schema/resource.ts
index 6677f906d..4f7b051a4 100644
--- a/packages/db/src/schema/resource.ts
+++ b/packages/db/src/schema/resource.ts
@@ -40,13 +40,13 @@ import { z } from "zod";
import {
ColumnOperator,
ComparisonOperator,
+ ConditionType,
DateOperator,
- FilterType,
MetadataOperator,
} from "@ctrlplane/validators/conditions";
import {
resourceCondition,
- ResourceFilterType,
+ ResourceConditionType,
} from "@ctrlplane/validators/resources";
import type { Tx } from "../common.js";
@@ -288,21 +288,21 @@ const buildLastSyncCondition = (tx: Tx, cond: LastSyncCondition): SQL => {
};
const buildCondition = (tx: Tx, cond: ResourceCondition): SQL => {
- if (cond.type === ResourceFilterType.Metadata)
+ if (cond.type === ResourceConditionType.Metadata)
return buildMetadataCondition(tx, cond);
- if (cond.type === ResourceFilterType.Kind)
+ if (cond.type === ResourceConditionType.Kind)
return eq(resource.kind, cond.value);
- if (cond.type === ResourceFilterType.Name)
+ if (cond.type === ResourceConditionType.Name)
return buildNameCondition(tx, cond);
- if (cond.type === ResourceFilterType.Provider)
+ if (cond.type === ResourceConditionType.Provider)
return eq(resource.providerId, cond.value);
- if (cond.type === ResourceFilterType.Identifier)
+ if (cond.type === ResourceConditionType.Identifier)
return buildIdentifierCondition(tx, cond);
- if (cond.type === FilterType.CreatedAt)
+ if (cond.type === ConditionType.CreatedAt)
return buildCreatedAtCondition(tx, cond);
- if (cond.type === ResourceFilterType.LastSync)
+ if (cond.type === ResourceConditionType.LastSync)
return buildLastSyncCondition(tx, cond);
- if (cond.type === ResourceFilterType.Version)
+ if (cond.type === ResourceConditionType.Version)
return eq(resource.version, cond.value);
if (cond.conditions.length === 0) return sql`FALSE`;
diff --git a/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts b/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts
index efd0f8903..8ca0081ce 100644
--- a/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts
+++ b/packages/job-dispatch/src/__test__/job-variables-deployment.test.ts
@@ -86,19 +86,19 @@ const variableValues: SCHEMA.DeploymentVariableValue[] = [
id: "0",
variableId: "0",
value: "test1",
- resourceFilter: null,
+ resourceSelector: null,
},
{
id: "1",
variableId: "0",
value: "test2",
- resourceFilter: null,
+ resourceSelector: null,
},
{
id: "2",
variableId: "0",
value: "test3",
- resourceFilter: null,
+ resourceSelector: null,
},
];
@@ -249,7 +249,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -319,7 +319,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -386,7 +386,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -453,7 +453,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -520,7 +520,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -617,7 +617,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
@@ -714,7 +714,7 @@ describe("job-variables-deployment", () => {
description: null,
systemId: "0",
policyId: "0",
- resourceFilter: null,
+ resourceSelector: null,
directory: "",
createdAt: new Date(),
environments: [
diff --git a/packages/job-dispatch/src/deployment-update.ts b/packages/job-dispatch/src/deployment-update.ts
index 4ee80f190..6ffcd63c6 100644
--- a/packages/job-dispatch/src/deployment-update.ts
+++ b/packages/job-dispatch/src/deployment-update.ts
@@ -8,7 +8,7 @@ import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { getEventsForDeploymentRemoved, handleEvent } from "./events/index.js";
@@ -43,7 +43,7 @@ const moveRunbooksLinkedToHooksToNewSystem = async (
};
const getResourcesInNewSystem = async (deployment: SCHEMA.Deployment) => {
- const hasFilter = isNotNull(SCHEMA.environment.resourceFilter);
+ const hasFilter = isNotNull(SCHEMA.environment.resourceSelector);
const newSystem = await db.query.system.findFirst({
where: eq(SCHEMA.system.id, deployment.systemId),
with: { environments: { where: hasFilter } },
@@ -52,13 +52,13 @@ const getResourcesInNewSystem = async (deployment: SCHEMA.Deployment) => {
if (newSystem == null) return [];
const filters = newSystem.environments
- .map((env) => env.resourceFilter)
+ .map((env) => env.resourceSelector)
.filter(isPresent);
if (filters.length === 0) return [];
const systemFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
conditions: filters,
};
@@ -109,21 +109,21 @@ const handleDeploymentFilterChanged = async (
});
const isInSystem: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.Or,
- conditions: environments.map((e) => e.resourceFilter).filter(isPresent),
+ conditions: environments.map((e) => e.resourceSelector).filter(isPresent),
};
const oldResourcesFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [prevFilter, isInSystem].filter(isPresent),
};
const newResourcesFilter: ResourceCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
- conditions: [deployment.resourceFilter, isInSystem].filter(isPresent),
+ conditions: [deployment.resourceSelector, isInSystem].filter(isPresent),
};
const oldResources = await db.query.resource.findMany({
@@ -193,11 +193,14 @@ export const updateDeployment = async (
);
if (
- !_.isEqual(prevDeployment.resourceFilter, updatedDeployment.resourceFilter)
+ !_.isEqual(
+ prevDeployment.resourceSelector,
+ updatedDeployment.resourceSelector,
+ )
)
await handleDeploymentFilterChanged(
updatedDeployment,
- prevDeployment.resourceFilter,
+ prevDeployment.resourceSelector,
userId,
);
diff --git a/packages/job-dispatch/src/environment-creation.ts b/packages/job-dispatch/src/environment-creation.ts
index e08cc9166..0aed2b8ac 100644
--- a/packages/job-dispatch/src/environment-creation.ts
+++ b/packages/job-dispatch/src/environment-creation.ts
@@ -14,8 +14,8 @@ export const createJobsForNewEnvironment = async (
db: Tx,
env: SCHEMA.Environment,
) => {
- const { resourceFilter } = env;
- if (resourceFilter == null) return;
+ const { resourceSelector } = env;
+ if (resourceSelector == null) return;
const versionChannels = await db.query.environment.findFirst({
where: eq(SCHEMA.environment.id, env.id),
@@ -42,7 +42,7 @@ export const createJobsForNewEnvironment = async (
.where(
and(
eq(SCHEMA.resource.workspaceId, workspaceId),
- SCHEMA.resourceMatchesMetadata(db, resourceFilter),
+ SCHEMA.resourceMatchesMetadata(db, resourceSelector),
isNull(SCHEMA.resource.deletedAt),
),
);
diff --git a/packages/job-dispatch/src/environment-release-channel-update.ts b/packages/job-dispatch/src/environment-release-channel-update.ts
index c079b1395..bc8e0625f 100644
--- a/packages/job-dispatch/src/environment-release-channel-update.ts
+++ b/packages/job-dispatch/src/environment-release-channel-update.ts
@@ -5,7 +5,7 @@ import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import {
ComparisonOperator,
- FilterType,
+ ConditionType,
} from "@ctrlplane/validators/conditions";
import { JobStatus } from "@ctrlplane/validators/jobs";
@@ -34,7 +34,7 @@ const createSelectorForExcludedVersions = (
if (oldVersionSelector == null && newVersionSelector == null) return null;
if (oldVersionSelector == null && newVersionSelector != null)
return {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
not: true,
operator: ComparisonOperator.And,
conditions: [newVersionSelector],
@@ -42,11 +42,11 @@ const createSelectorForExcludedVersions = (
if (oldVersionSelector != null && newVersionSelector == null) return null;
if (oldVersionSelector != null && newVersionSelector != null)
return {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
conditions: [
{
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
not: true,
operator: ComparisonOperator.And,
conditions: [newVersionSelector],
diff --git a/packages/job-dispatch/src/events/triggers/deployment-removed.ts b/packages/job-dispatch/src/events/triggers/deployment-removed.ts
index c9d5ac9e8..e81d14649 100644
--- a/packages/job-dispatch/src/events/triggers/deployment-removed.ts
+++ b/packages/job-dispatch/src/events/triggers/deployment-removed.ts
@@ -6,13 +6,13 @@ import { and, eq, isNotNull, isNull } from "@ctrlplane/db";
import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import { ComparisonOperator } from "@ctrlplane/validators/conditions";
-import { ResourceFilterType } from "@ctrlplane/validators/resources";
+import { ResourceConditionType } from "@ctrlplane/validators/resources";
export const getEventsForDeploymentRemoved = async (
deployment: SCHEMA.Deployment,
systemId: string,
): Promise => {
- const hasFilter = isNotNull(SCHEMA.environment.resourceFilter);
+ const hasFilter = isNotNull(SCHEMA.environment.resourceSelector);
const system = await db.query.system.findFirst({
where: eq(SCHEMA.system.id, systemId),
with: { environments: { where: hasFilter } },
@@ -20,12 +20,12 @@ export const getEventsForDeploymentRemoved = async (
if (system == null) return [];
const envFilters = system.environments
- .map((e) => e.resourceFilter)
+ .map((e) => e.resourceSelector)
.filter(isPresent);
if (envFilters.length === 0) return [];
const systemFilter: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ComparisonOperator.Or,
conditions: envFilters,
};
diff --git a/packages/job-dispatch/src/events/triggers/environment-deleted.ts b/packages/job-dispatch/src/events/triggers/environment-deleted.ts
index 53e0b8fb9..d031fc750 100644
--- a/packages/job-dispatch/src/events/triggers/environment-deleted.ts
+++ b/packages/job-dispatch/src/events/triggers/environment-deleted.ts
@@ -6,25 +6,25 @@ import { and, eq, inArray, isNotNull, isNull, ne } from "@ctrlplane/db";
import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import { ComparisonOperator } from "@ctrlplane/validators/conditions";
-import { ResourceFilterType } from "@ctrlplane/validators/resources";
+import { ResourceConditionType } from "@ctrlplane/validators/resources";
export const getEventsForEnvironmentDeleted = async (
environment: SCHEMA.Environment,
): Promise => {
- if (environment.resourceFilter == null) return [];
+ if (environment.resourceSelector == null) return [];
const resources = await db
.select()
.from(SCHEMA.resource)
.where(
and(
- SCHEMA.resourceMatchesMetadata(db, environment.resourceFilter),
+ SCHEMA.resourceMatchesMetadata(db, environment.resourceSelector),
isNull(SCHEMA.resource.deletedAt),
),
);
if (resources.length === 0) return [];
const checks = and(
- isNotNull(SCHEMA.environment.resourceFilter),
+ isNotNull(SCHEMA.environment.resourceSelector),
ne(SCHEMA.environment.id, environment.id),
);
const system = await db.query.system.findFirst({
@@ -34,11 +34,11 @@ export const getEventsForEnvironmentDeleted = async (
if (system == null) return [];
const envFilters = system.environments
- .map((e) => e.resourceFilter)
+ .map((e) => e.resourceSelector)
.filter(isPresent);
const removedFromSystemFilter: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ComparisonOperator.Or,
not: true,
conditions: envFilters,
diff --git a/packages/job-dispatch/src/events/triggers/resource-deleted.ts b/packages/job-dispatch/src/events/triggers/resource-deleted.ts
index 001089c85..787a0d23c 100644
--- a/packages/job-dispatch/src/events/triggers/resource-deleted.ts
+++ b/packages/job-dispatch/src/events/triggers/resource-deleted.ts
@@ -6,7 +6,7 @@ import { and, eq, isNotNull, isNull } from "@ctrlplane/db";
import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import { ComparisonOperator } from "@ctrlplane/validators/conditions";
-import { ResourceFilterType } from "@ctrlplane/validators/resources";
+import { ResourceConditionType } from "@ctrlplane/validators/resources";
/**
* Get events for a resource that has been deleted.
@@ -18,18 +18,18 @@ export const getEventsForResourceDeleted = async (
const systems = await db.query.system.findMany({
where: eq(SCHEMA.system.workspaceId, resource.workspaceId),
with: {
- environments: { where: isNotNull(SCHEMA.environment.resourceFilter) },
+ environments: { where: isNotNull(SCHEMA.environment.resourceSelector) },
deployments: true,
},
});
const deploymentPromises = systems.map(async (s) => {
const filters = s.environments
- .map((e) => e.resourceFilter)
+ .map((e) => e.resourceSelector)
.filter(isPresent);
const systemFilter: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ComparisonOperator.Or,
conditions: filters,
};
diff --git a/packages/job-dispatch/src/job-variables-deployment/job-variables-deployment.ts b/packages/job-dispatch/src/job-variables-deployment/job-variables-deployment.ts
index 1f866f940..11e7acbf7 100644
--- a/packages/job-dispatch/src/job-variables-deployment/job-variables-deployment.ts
+++ b/packages/job-dispatch/src/job-variables-deployment/job-variables-deployment.ts
@@ -145,7 +145,7 @@ export const determineReleaseVariableValue = async (
);
const valuesWithFilter = deploymentVariableValues.filter((v) =>
- isPresent(v.resourceFilter),
+ isPresent(v.resourceSelector),
);
const firstMatchedValue = await utils.getFirstMatchedResource(
diff --git a/packages/job-dispatch/src/job-variables-deployment/utils.ts b/packages/job-dispatch/src/job-variables-deployment/utils.ts
index 9d8e3ca0c..2c3fa3a14 100644
--- a/packages/job-dispatch/src/job-variables-deployment/utils.ts
+++ b/packages/job-dispatch/src/job-variables-deployment/utils.ts
@@ -75,7 +75,7 @@ export const getVariableValues = (tx: Tx, variableId: string) =>
export const getMatchedResource = (
tx: Tx,
resourceId: string,
- resourceFilter: ResourceCondition | null,
+ resourceSelector: ResourceCondition | null,
) =>
tx
.select()
@@ -83,7 +83,7 @@ export const getMatchedResource = (
.where(
and(
eq(SCHEMA.resource.id, resourceId),
- SCHEMA.resourceMatchesMetadata(tx, resourceFilter),
+ SCHEMA.resourceMatchesMetadata(tx, resourceSelector),
isNull(SCHEMA.resource.deletedAt),
),
)
@@ -96,7 +96,7 @@ export const getFirstMatchedResource = (
) =>
Promise.all(
values.map((value) =>
- getMatchedResource(tx, resourceId, value.resourceFilter).then(
+ getMatchedResource(tx, resourceId, value.resourceSelector).then(
(matchedResource) => (matchedResource != null ? value : null),
),
),
diff --git a/packages/job-dispatch/src/policies/release-sequencing.ts b/packages/job-dispatch/src/policies/release-sequencing.ts
index 634afff6a..fa1cc4552 100644
--- a/packages/job-dispatch/src/policies/release-sequencing.ts
+++ b/packages/job-dispatch/src/policies/release-sequencing.ts
@@ -91,7 +91,7 @@ const isReleaseLatestActiveForEnvironment = async (
const releaseChannelSubquery = db
.select({
rcPolicyId: schema.environmentPolicyDeploymentVersionChannel.policyId,
- rcReleaseFilter: schema.deploymentVersionChannel.versionSelector,
+ rcReleaseSelector: schema.deploymentVersionChannel.versionSelector,
})
.from(schema.environmentPolicyDeploymentVersionChannel)
.innerJoin(
@@ -148,7 +148,7 @@ const isReleaseLatestActiveForEnvironment = async (
eq(schema.releaseJobTrigger.environmentId, environmentId),
schema.deploymentVersionMatchesCondition(
db,
- environment.release_channel?.rcReleaseFilter,
+ environment.release_channel?.rcReleaseSelector,
),
),
)
diff --git a/packages/job-dispatch/src/release-job-trigger.ts b/packages/job-dispatch/src/release-job-trigger.ts
index e8814fa68..f12199c69 100644
--- a/packages/job-dispatch/src/release-job-trigger.ts
+++ b/packages/job-dispatch/src/release-job-trigger.ts
@@ -84,7 +84,7 @@ class ReleaseJobTriggerBuilder {
this.environmentIds &&
inArray(SCHEMA.environment.id, this.environmentIds),
].filter(isPresent),
- isNotNull(SCHEMA.environment.resourceFilter),
+ isNotNull(SCHEMA.environment.resourceSelector),
);
}
@@ -138,15 +138,16 @@ class ReleaseJobTriggerBuilder {
const versions = await releaseJobTriggers.where(this._where());
return Promise.all(
versions.flatMap(async (version) => {
- const { resourceFilter } = version.environment;
- const { resourceFilter: deploymentResourceFilter } = version.deployment;
+ const { resourceSelector } = version.environment;
+ const { resourceSelector: deploymentResourceFilter } =
+ version.deployment;
const { workspaceId } = version.system;
const resources = await this.tx
.select()
.from(SCHEMA.resource)
.where(
and(
- SCHEMA.resourceMatchesMetadata(this.tx, resourceFilter),
+ SCHEMA.resourceMatchesMetadata(this.tx, resourceSelector),
SCHEMA.resourceMatchesMetadata(this.tx, deploymentResourceFilter),
eq(SCHEMA.resource.workspaceId, workspaceId),
isNull(SCHEMA.resource.lockedAt),
diff --git a/packages/job-dispatch/src/resource/dispatch-resource.ts b/packages/job-dispatch/src/resource/dispatch-resource.ts
index ceb81ed78..55bacf473 100644
--- a/packages/job-dispatch/src/resource/dispatch-resource.ts
+++ b/packages/job-dispatch/src/resource/dispatch-resource.ts
@@ -14,7 +14,7 @@ import { db } from "@ctrlplane/db/client";
import * as SCHEMA from "@ctrlplane/db/schema";
import { logger } from "@ctrlplane/logger";
import { ComparisonOperator } from "@ctrlplane/validators/conditions";
-import { ResourceFilterType } from "@ctrlplane/validators/resources";
+import { ResourceConditionType } from "@ctrlplane/validators/resources";
import { handleEvent } from "../events/index.js";
import { dispatchReleaseJobTriggers } from "../job-dispatch.js";
@@ -160,7 +160,7 @@ const getEnvironmentDeployments = (db: Tx, envId: string) =>
const getNotInSystemFilter = async (
systemId: string,
): Promise => {
- const hasFilter = isNotNull(SCHEMA.environment.resourceFilter);
+ const hasFilter = isNotNull(SCHEMA.environment.resourceSelector);
const system = await db.query.system.findFirst({
where: eq(SCHEMA.system.id, systemId),
with: { environments: { where: hasFilter } },
@@ -168,12 +168,12 @@ const getNotInSystemFilter = async (
if (system == null) return null;
const filters = system.environments
- .map((e) => e.resourceFilter)
+ .map((e) => e.resourceSelector)
.filter(isPresent);
if (filters.length === 0) return null;
return {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ComparisonOperator.Or,
not: true,
conditions: filters,
diff --git a/packages/job-dispatch/src/resource/utils.ts b/packages/job-dispatch/src/resource/utils.ts
index 624596a26..7b814ba84 100644
--- a/packages/job-dispatch/src/resource/utils.ts
+++ b/packages/job-dispatch/src/resource/utils.ts
@@ -76,7 +76,7 @@ export const getEnvironmentsByResourceWithIdentifiers = (
tx
.select({
id: schema.environment.id,
- resourceFilter: schema.environment.resourceFilter,
+ resourceFilter: schema.environment.resourceSelector,
systemId: schema.environment.systemId,
})
.from(schema.environment)
@@ -84,7 +84,7 @@ export const getEnvironmentsByResourceWithIdentifiers = (
.where(
and(
eq(schema.system.workspaceId, workspaceId),
- isNotNull(schema.environment.resourceFilter),
+ isNotNull(schema.environment.resourceSelector),
),
)
.then((envs) =>
diff --git a/packages/node-sdk/src/schema.ts b/packages/node-sdk/src/schema.ts
index a1af126f9..f81b45f16 100644
--- a/packages/node-sdk/src/schema.ts
+++ b/packages/node-sdk/src/schema.ts
@@ -1710,7 +1710,7 @@ export interface operations {
deploymentId: string;
name: string;
description?: string | null;
- releaseFilter: {
+ releaseSelector: {
[key: string]: unknown;
};
};
@@ -1730,7 +1730,7 @@ export interface operations {
description?: string | null;
/** Format: date-time */
createdAt: string;
- releaseFilter?: {
+ releaseSelector?: {
[key: string]: unknown;
};
};
diff --git a/packages/validators/src/conditions/index.ts b/packages/validators/src/conditions/index.ts
index 3428fe31e..3c464b644 100644
--- a/packages/validators/src/conditions/index.ts
+++ b/packages/validators/src/conditions/index.ts
@@ -19,7 +19,7 @@ export enum ComparisonOperator {
Or = "or",
}
-export enum FilterType {
+export enum ConditionType {
Metadata = "metadata",
CreatedAt = "created-at",
Comparison = "comparison",
diff --git a/packages/validators/src/jobs/conditions/job-condition.ts b/packages/validators/src/jobs/conditions/job-condition.ts
index 9bace2a48..a485dd186 100644
--- a/packages/validators/src/jobs/conditions/job-condition.ts
+++ b/packages/validators/src/jobs/conditions/job-condition.ts
@@ -13,8 +13,8 @@ import type { ReleaseCondition } from "./release-condition.js";
import type { StatusCondition } from "./status-condition.js";
import {
ComparisonOperator,
+ ConditionType,
createdAtCondition,
- FilterType,
MAX_DEPTH_ALLOWED,
metadataCondition,
MetadataOperator,
@@ -51,13 +51,13 @@ export const jobCondition = z.union([
]);
export const defaultCondition: JobCondition = {
- type: FilterType.Comparison,
+ type: ConditionType.Comparison,
operator: ComparisonOperator.And,
not: false,
conditions: [],
};
-export enum JobFilterType {
+export enum JobConditionType {
Status = "status",
Deployment = "deployment",
Environment = "environment",
@@ -66,42 +66,45 @@ export enum JobFilterType {
}
export const isEmptyCondition = (condition: JobCondition): boolean =>
- condition.type === FilterType.Comparison && condition.conditions.length === 0;
+ condition.type === ConditionType.Comparison &&
+ condition.conditions.length === 0;
export const isComparisonCondition = (
condition: JobCondition,
-): condition is ComparisonCondition => condition.type === FilterType.Comparison;
+): condition is ComparisonCondition =>
+ condition.type === ConditionType.Comparison;
export const isMetadataCondition = (
condition: JobCondition,
-): condition is MetadataCondition => condition.type === FilterType.Metadata;
+): condition is MetadataCondition => condition.type === ConditionType.Metadata;
export const isCreatedAtCondition = (
condition: JobCondition,
-): condition is CreatedAtCondition => condition.type === FilterType.CreatedAt;
+): condition is CreatedAtCondition =>
+ condition.type === ConditionType.CreatedAt;
export const isStatusCondition = (
condition: JobCondition,
-): condition is StatusCondition => condition.type === JobFilterType.Status;
+): condition is StatusCondition => condition.type === JobConditionType.Status;
export const isEnvironmentCondition = (
condition: JobCondition,
): condition is EnvironmentCondition =>
- condition.type === JobFilterType.Environment;
+ condition.type === JobConditionType.Environment;
export const isDeploymentCondition = (
condition: JobCondition,
): condition is DeploymentCondition =>
- condition.type === JobFilterType.Deployment;
+ condition.type === JobConditionType.Deployment;
export const isVersionCondition = (
condition: JobCondition,
-): condition is VersionCondition => condition.type === FilterType.Version;
+): condition is VersionCondition => condition.type === ConditionType.Version;
export const isJobResourceCondition = (
condition: JobCondition,
): condition is JobResourceCondition =>
- condition.type === JobFilterType.JobResource;
+ condition.type === JobConditionType.JobResource;
// Check if converting to a comparison condition will exceed the max depth
// including any nested conditions
diff --git a/packages/validators/src/resources/conditions/resource-condition.ts b/packages/validators/src/resources/conditions/resource-condition.ts
index 82eaeb60b..498d8aa64 100644
--- a/packages/validators/src/resources/conditions/resource-condition.ts
+++ b/packages/validators/src/resources/conditions/resource-condition.ts
@@ -12,8 +12,8 @@ import type { NameCondition } from "./name-condition.js";
import type { ProviderCondition } from "./provider-condition.js";
import type { VersionCondition } from "./version-condition.js";
import {
+ ConditionType,
createdAtCondition,
- FilterType,
metadataCondition,
} from "../../conditions/index.js";
import { comparisonCondition } from "./comparison-condition.js";
@@ -55,7 +55,7 @@ export enum ResourceOperator {
Or = "or",
}
-export enum ResourceFilterType {
+export enum ResourceConditionType {
Metadata = "metadata",
Kind = "kind",
Name = "name",
@@ -67,7 +67,7 @@ export enum ResourceFilterType {
}
export const defaultCondition: ResourceCondition = {
- type: ResourceFilterType.Comparison,
+ type: ResourceConditionType.Comparison,
operator: ResourceOperator.And,
not: false,
conditions: [],
@@ -76,7 +76,7 @@ export const defaultCondition: ResourceCondition = {
export const isComparisonCondition = (
condition: ResourceCondition,
): condition is ComparisonCondition =>
- condition.type === ResourceFilterType.Comparison;
+ condition.type === ResourceConditionType.Comparison;
export const MAX_DEPTH_ALLOWED = 2; // 0 indexed
@@ -102,39 +102,40 @@ export const isEmptyCondition = (condition: ResourceCondition): boolean =>
export const isMetadataCondition = (
condition: ResourceCondition,
): condition is MetadataCondition =>
- condition.type === ResourceFilterType.Metadata;
+ condition.type === ResourceConditionType.Metadata;
export const isKindCondition = (
condition: ResourceCondition,
-): condition is KindCondition => condition.type === ResourceFilterType.Kind;
+): condition is KindCondition => condition.type === ResourceConditionType.Kind;
export const isNameCondition = (
condition: ResourceCondition,
-): condition is NameCondition => condition.type === ResourceFilterType.Name;
+): condition is NameCondition => condition.type === ResourceConditionType.Name;
export const isProviderCondition = (
condition: ResourceCondition,
): condition is ProviderCondition =>
- condition.type === ResourceFilterType.Provider;
+ condition.type === ResourceConditionType.Provider;
export const isIdentifierCondition = (
condition: ResourceCondition,
): condition is IdentifierCondition =>
- condition.type === ResourceFilterType.Identifier;
+ condition.type === ResourceConditionType.Identifier;
export const isCreatedAtCondition = (
condition: ResourceCondition,
-): condition is CreatedAtCondition => condition.type === FilterType.CreatedAt;
+): condition is CreatedAtCondition =>
+ condition.type === ConditionType.CreatedAt;
export const isLastSyncCondition = (
condition: ResourceCondition,
): condition is LastSyncCondition =>
- condition.type === ResourceFilterType.LastSync;
+ condition.type === ResourceConditionType.LastSync;
export const isVersionCondition = (
condition: ResourceCondition,
): condition is VersionCondition =>
- condition.type === ResourceFilterType.Version;
+ condition.type === ResourceConditionType.Version;
export const isValidResourceCondition = (
condition: ResourceCondition,