From 3b1c5949bad71dab9c88ffce050d7b132fd29be6 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 11:15:59 -0700 Subject: [PATCH 01/10] feat: global variable sets --- apps/workspace-engine/oapi/openapi.json | 108 ++++++++ apps/workspace-engine/oapi/spec/main.jsonnet | 3 +- .../oapi/spec/schemas/variablesets.jsonnet | 48 ++++ apps/workspace-engine/pkg/oapi/oapi.gen.go | 189 +++++++++++++ .../variableresolver/getters.go | 4 +- .../variableresolver/getters_postgres.go | 9 +- .../variableresolver/resolve_test.go | 255 +++++++++++++++++- packages/db/src/schema/index.ts | 1 + packages/db/src/schema/variable-set.ts | 54 ++++ 9 files changed, 665 insertions(+), 6 deletions(-) create mode 100644 apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet create mode 100644 packages/db/src/schema/variable-set.ts diff --git a/apps/workspace-engine/oapi/openapi.json b/apps/workspace-engine/oapi/openapi.json index 8d7cd5360..3871f96ae 100644 --- a/apps/workspace-engine/oapi/openapi.json +++ b/apps/workspace-engine/oapi/openapi.json @@ -2670,6 +2670,114 @@ } ] }, + "VariableSet": { + "properties": { + "createdAt": { + "description": "The timestamp when the variable set was created", + "format": "date-time", + "type": "string" + }, + "description": { + "description": "The description of the variable set", + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "description": "The name of the variable set", + "type": "string" + }, + "priority": { + "description": "The priority of the variable set", + "format": "int64", + "type": "integer" + }, + "selector": { + "description": "A CEL expression to select which resources this value applies to", + "type": "string" + }, + "updatedAt": { + "description": "The timestamp when the variable set was last updated", + "format": "date-time", + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "selector", + "priority", + "createdAt", + "updatedAt" + ], + "type": "object" + }, + "VariableSetVariable": { + "properties": { + "id": { + "description": "The ID of the variable", + "format": "uuid", + "type": "string" + }, + "key": { + "description": "The key of the variable, unique within the variable set", + "type": "string" + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "additionalProperties": true, + "type": "object" + } + ] + }, + "variableSetId": { + "description": "The ID of the variable set this variable belongs to", + "format": "uuid", + "type": "string" + } + }, + "required": [ + "id", + "variableSetId", + "key", + "value" + ], + "type": "object" + }, + "VariableSetWithVariables": { + "allOf": [ + { + "$ref": "#/components/schemas/VariableSet" + }, + { + "properties": { + "variables": { + "items": { + "$ref": "#/components/schemas/VariableSetVariable" + }, + "type": "array" + } + }, + "required": [ + "variables" + ], + "type": "object" + } + ] + }, "VerificationMeasurement": { "properties": { "data": { diff --git a/apps/workspace-engine/oapi/spec/main.jsonnet b/apps/workspace-engine/oapi/spec/main.jsonnet index 2d953c482..038a0027a 100644 --- a/apps/workspace-engine/oapi/spec/main.jsonnet +++ b/apps/workspace-engine/oapi/spec/main.jsonnet @@ -30,6 +30,7 @@ (import 'schemas/resourcevariables.jsonnet') + (import 'schemas/systems.jsonnet') + (import 'schemas/workflows.jsonnet') + - (import 'schemas/release_targets.jsonnet'), + (import 'schemas/release_targets.jsonnet') + + (import 'schemas/variablesets.jsonnet'), }, } diff --git a/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet b/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet new file mode 100644 index 000000000..b6aabc1e6 --- /dev/null +++ b/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet @@ -0,0 +1,48 @@ +local openapi = import '../lib/openapi.libsonnet'; + +{ + VariableSet: { + type: 'object', + required: ['id', 'name', 'description', 'selector', 'priority', 'createdAt', 'updatedAt'], + properties: { + id: { type: 'string', format: 'uuid' }, + name: { type: 'string', description: 'The name of the variable set' }, + description: { type: 'string', description: 'The description of the variable set' }, + selector: { type: 'string', description: 'A CEL expression to select which resources this value applies to' }, + priority: { type: 'integer', format: 'int64', description: 'The priority of the variable set' }, + createdAt: { type: 'string', format: 'date-time', description: 'The timestamp when the variable set was created' }, + updatedAt: { type: 'string', format: 'date-time', description: 'The timestamp when the variable set was last updated' }, + }, + }, + + VariableSetVariable: { + type: 'object', + required: ['id', 'variableSetId', 'key', 'value'], + properties: { + id: { type: 'string', format: 'uuid', description: 'The ID of the variable' }, + variableSetId: { type: 'string', format: 'uuid', description: 'The ID of the variable set this variable belongs to' }, + key: { type: 'string', description: 'The key of the variable, unique within the variable set' }, + value: { + oneOf: [ + { type: 'string' }, + { type: 'number' }, + { type: 'boolean' }, + { type: 'object', additionalProperties: true }, + ], + }, + }, + }, + + VariableSetWithVariables: { + allOf: [ + openapi.schemaRef('VariableSet'), + { + type: 'object', + required: ['variables'], + properties: { + variables: { type: 'array', items: openapi.schemaRef('VariableSetVariable') }, + }, + }, + ], + }, +} diff --git a/apps/workspace-engine/pkg/oapi/oapi.gen.go b/apps/workspace-engine/pkg/oapi/oapi.gen.go index 812846177..db0cc2387 100644 --- a/apps/workspace-engine/pkg/oapi/oapi.gen.go +++ b/apps/workspace-engine/pkg/oapi/oapi.gen.go @@ -1232,6 +1232,81 @@ type Value struct { union json.RawMessage } +// VariableSet defines model for VariableSet. +type VariableSet struct { + // CreatedAt The timestamp when the variable set was created + CreatedAt time.Time `json:"createdAt"` + + // Description The description of the variable set + Description string `json:"description"` + Id openapi_types.UUID `json:"id"` + + // Name The name of the variable set + Name string `json:"name"` + + // Priority The priority of the variable set + Priority int64 `json:"priority"` + + // Selector A CEL expression to select which resources this value applies to + Selector string `json:"selector"` + + // UpdatedAt The timestamp when the variable set was last updated + UpdatedAt time.Time `json:"updatedAt"` +} + +// VariableSetVariable defines model for VariableSetVariable. +type VariableSetVariable struct { + // Id The ID of the variable + Id openapi_types.UUID `json:"id"` + + // Key The key of the variable, unique within the variable set + Key string `json:"key"` + Value VariableSetVariable_Value `json:"value"` + + // VariableSetId The ID of the variable set this variable belongs to + VariableSetId openapi_types.UUID `json:"variableSetId"` +} + +// VariableSetVariableValue0 defines model for . +type VariableSetVariableValue0 = string + +// VariableSetVariableValue1 defines model for . +type VariableSetVariableValue1 = float32 + +// VariableSetVariableValue2 defines model for . +type VariableSetVariableValue2 = bool + +// VariableSetVariableValue3 defines model for . +type VariableSetVariableValue3 map[string]interface{} + +// VariableSetVariable_Value defines model for VariableSetVariable.Value. +type VariableSetVariable_Value struct { + union json.RawMessage +} + +// VariableSetWithVariables defines model for VariableSetWithVariables. +type VariableSetWithVariables struct { + // CreatedAt The timestamp when the variable set was created + CreatedAt time.Time `json:"createdAt"` + + // Description The description of the variable set + Description string `json:"description"` + Id openapi_types.UUID `json:"id"` + + // Name The name of the variable set + Name string `json:"name"` + + // Priority The priority of the variable set + Priority int64 `json:"priority"` + + // Selector A CEL expression to select which resources this value applies to + Selector string `json:"selector"` + + // UpdatedAt The timestamp when the variable set was last updated + UpdatedAt time.Time `json:"updatedAt"` + Variables []VariableSetVariable `json:"variables"` +} + // VerificationMeasurement defines model for VerificationMeasurement. type VerificationMeasurement struct { // Data Raw measurement data @@ -2224,6 +2299,120 @@ func (t *Value) UnmarshalJSON(b []byte) error { return err } +// AsVariableSetVariableValue0 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue0 +func (t VariableSetVariable_Value) AsVariableSetVariableValue0() (VariableSetVariableValue0, error) { + var body VariableSetVariableValue0 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromVariableSetVariableValue0 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue0 +func (t *VariableSetVariable_Value) FromVariableSetVariableValue0(v VariableSetVariableValue0) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeVariableSetVariableValue0 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue0 +func (t *VariableSetVariable_Value) MergeVariableSetVariableValue0(v VariableSetVariableValue0) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsVariableSetVariableValue1 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue1 +func (t VariableSetVariable_Value) AsVariableSetVariableValue1() (VariableSetVariableValue1, error) { + var body VariableSetVariableValue1 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromVariableSetVariableValue1 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue1 +func (t *VariableSetVariable_Value) FromVariableSetVariableValue1(v VariableSetVariableValue1) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeVariableSetVariableValue1 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue1 +func (t *VariableSetVariable_Value) MergeVariableSetVariableValue1(v VariableSetVariableValue1) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsVariableSetVariableValue2 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue2 +func (t VariableSetVariable_Value) AsVariableSetVariableValue2() (VariableSetVariableValue2, error) { + var body VariableSetVariableValue2 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromVariableSetVariableValue2 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue2 +func (t *VariableSetVariable_Value) FromVariableSetVariableValue2(v VariableSetVariableValue2) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeVariableSetVariableValue2 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue2 +func (t *VariableSetVariable_Value) MergeVariableSetVariableValue2(v VariableSetVariableValue2) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsVariableSetVariableValue3 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue3 +func (t VariableSetVariable_Value) AsVariableSetVariableValue3() (VariableSetVariableValue3, error) { + var body VariableSetVariableValue3 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromVariableSetVariableValue3 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue3 +func (t *VariableSetVariable_Value) FromVariableSetVariableValue3(v VariableSetVariableValue3) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeVariableSetVariableValue3 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue3 +func (t *VariableSetVariable_Value) MergeVariableSetVariableValue3(v VariableSetVariableValue3) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t VariableSetVariable_Value) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *VariableSetVariable_Value) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsWorkflowManualArrayInput returns the union data inside the WorkflowArrayInput as a WorkflowManualArrayInput func (t WorkflowArrayInput) AsWorkflowManualArrayInput() (WorkflowManualArrayInput, error) { var body WorkflowManualArrayInput diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go index 307750b3f..cc30473a4 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go @@ -3,9 +3,10 @@ package variableresolver import ( "context" - "github.com/google/uuid" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" + + "github.com/google/uuid" ) // Getter provides the data needed to resolve deployment variables for a @@ -20,6 +21,7 @@ type Getter interface { ctx context.Context, resourceID string, ) (map[string]oapi.ResourceVariable, error) + GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) GetRelationshipRules(ctx context.Context, workspaceID uuid.UUID) ([]eval.Rule, error) LoadCandidates( ctx context.Context, diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go index 6f4396a48..a441d1c38 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go @@ -4,11 +4,12 @@ import ( "context" "fmt" - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" "workspace-engine/pkg/db" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" ) var _ Getter = (*PostgresGetter)(nil) @@ -160,6 +161,10 @@ func (g *PostgresGetter) GetResourceVariables( return result, nil } +func (g *PostgresGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { + return nil, nil +} + func (g *PostgresGetter) GetRelationshipRules( ctx context.Context, workspaceID uuid.UUID, diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go index e28c1b918..01ae07746 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go @@ -5,11 +5,12 @@ import ( "fmt" "testing" + "workspace-engine/pkg/oapi" + "workspace-engine/pkg/workspace/relationships/eval" + "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "workspace-engine/pkg/oapi" - "workspace-engine/pkg/workspace/relationships/eval" ) // --------------------------------------------------------------------------- @@ -34,6 +35,7 @@ func (m *mockResolver) ResolveRelated( type mockGetter struct { deploymentVars []oapi.DeploymentVariableWithValues resourceVars map[string]oapi.ResourceVariable + variableSets []oapi.VariableSetWithVariables rules []eval.Rule candidates map[string][]eval.EntityData } @@ -51,6 +53,11 @@ func (m *mockGetter) GetResourceVariables( ) (map[string]oapi.ResourceVariable, error) { return m.resourceVars, nil } + +func (m *mockGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { + return m.variableSets, nil +} + func (m *mockGetter) GetRelationshipRules(_ context.Context, _ uuid.UUID) ([]eval.Rule, error) { return m.rules, nil } @@ -964,3 +971,247 @@ func TestResolveValue_Sensitive_ReturnsError(t *testing.T) { require.Error(t, err) assert.Contains(t, err.Error(), "sensitive") } + +// --------------------------------------------------------------------------- +// helpers — variable sets +// --------------------------------------------------------------------------- + +func newVariableSetValue(s string) oapi.VariableSetVariable_Value { + var v oapi.VariableSetVariable_Value + _ = v.FromVariableSetVariableValue0(s) + return v +} + +func makeVariableSet( + name, selector string, + priority int64, + vars map[string]string, +) oapi.VariableSetWithVariables { + vsID := uuid.New() + variables := make([]oapi.VariableSetVariable, 0, len(vars)) + for k, val := range vars { + variables = append(variables, oapi.VariableSetVariable{ + Id: uuid.New(), + VariableSetId: vsID, + Key: k, + Value: newVariableSetValue(val), + }) + } + return oapi.VariableSetWithVariables{ + Id: vsID, + Name: name, + Selector: selector, + Priority: priority, + Variables: variables, + } +} + +// --------------------------------------------------------------------------- +// Variable Set tests — simple injection +// --------------------------------------------------------------------------- + +func TestResolve_VariableSet_SimpleInjection(t *testing.T) { + scope := newScope() + scope.Resource.Metadata = map[string]string{"env": "production"} + + getter := &mockGetter{ + deploymentVars: []oapi.DeploymentVariableWithValues{{ + Variable: oapi.DeploymentVariable{ + Id: uuid.New().String(), + DeploymentId: scope.Deployment.Id, + Key: "log_level", + }, + Values: []oapi.DeploymentVariableValue{}, + }}, + resourceVars: map[string]oapi.ResourceVariable{}, + variableSets: []oapi.VariableSetWithVariables{ + makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ + "log_level": "warn", + }), + }, + } + + resolved, err := Resolve( + context.Background(), + getter, + scope, + scope.Deployment.Id, + scope.Resource.Id, + ) + require.NoError(t, err) + require.Contains(t, resolved, "log_level") + s, err := resolved["log_level"].AsStringValue() + require.NoError(t, err) + assert.Equal(t, "warn", s) +} + +// --------------------------------------------------------------------------- +// Variable Set tests — does not overwrite resource variable +// --------------------------------------------------------------------------- + +func TestResolve_VariableSet_DoesNotOverwriteResourceVar(t *testing.T) { + scope := newScope() + scope.Resource.Metadata = map[string]string{"env": "production"} + + getter := &mockGetter{ + deploymentVars: []oapi.DeploymentVariableWithValues{{ + Variable: oapi.DeploymentVariable{ + Id: uuid.New().String(), + DeploymentId: scope.Deployment.Id, + Key: "log_level", + }, + Values: []oapi.DeploymentVariableValue{}, + }}, + resourceVars: map[string]oapi.ResourceVariable{ + "log_level": { + Key: "log_level", + ResourceId: scope.Resource.Id, + Value: literalStringValue("debug"), + }, + }, + variableSets: []oapi.VariableSetWithVariables{ + makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ + "log_level": "warn", + }), + }, + } + + resolved, err := Resolve( + context.Background(), + getter, + scope, + scope.Deployment.Id, + scope.Resource.Id, + ) + require.NoError(t, err) + require.Contains(t, resolved, "log_level") + s, err := resolved["log_level"].AsStringValue() + require.NoError(t, err) + assert.Equal(t, "debug", s) +} + +// --------------------------------------------------------------------------- +// Variable Set tests — does not overwrite deployment variable value +// --------------------------------------------------------------------------- + +func TestResolve_VariableSet_DoesNotOverwriteDeploymentVarValue(t *testing.T) { + scope := newScope() + scope.Resource.Metadata = map[string]string{"env": "production"} + depVarID := uuid.New().String() + + getter := &mockGetter{ + deploymentVars: []oapi.DeploymentVariableWithValues{{ + Variable: oapi.DeploymentVariable{ + Id: depVarID, + DeploymentId: scope.Deployment.Id, + Key: "log_level", + }, + Values: []oapi.DeploymentVariableValue{{ + Id: uuid.New().String(), + DeploymentVariableId: depVarID, + Value: literalStringValue("info"), + Priority: 1, + }}, + }}, + resourceVars: map[string]oapi.ResourceVariable{}, + variableSets: []oapi.VariableSetWithVariables{ + makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ + "log_level": "warn", + }), + }, + } + + resolved, err := Resolve( + context.Background(), + getter, + scope, + scope.Deployment.Id, + scope.Resource.Id, + ) + require.NoError(t, err) + require.Contains(t, resolved, "log_level") + s, err := resolved["log_level"].AsStringValue() + require.NoError(t, err) + assert.Equal(t, "info", s) +} + +// --------------------------------------------------------------------------- +// Variable Set tests — multiple sets, highest priority wins +// --------------------------------------------------------------------------- + +func TestResolve_VariableSet_HighestPriorityWins(t *testing.T) { + scope := newScope() + scope.Resource.Metadata = map[string]string{"env": "production"} + + getter := &mockGetter{ + deploymentVars: []oapi.DeploymentVariableWithValues{{ + Variable: oapi.DeploymentVariable{ + Id: uuid.New().String(), + DeploymentId: scope.Deployment.Id, + Key: "log_level", + }, + Values: []oapi.DeploymentVariableValue{}, + }}, + resourceVars: map[string]oapi.ResourceVariable{}, + variableSets: []oapi.VariableSetWithVariables{ + makeVariableSet("low-priority", `resource.metadata.env == "production"`, 1, map[string]string{ + "log_level": "trace", + }), + makeVariableSet("high-priority", `resource.metadata.env == "production"`, 100, map[string]string{ + "log_level": "error", + }), + makeVariableSet("medium-priority", `resource.metadata.env == "production"`, 50, map[string]string{ + "log_level": "info", + }), + }, + } + + resolved, err := Resolve( + context.Background(), + getter, + scope, + scope.Deployment.Id, + scope.Resource.Id, + ) + require.NoError(t, err) + require.Contains(t, resolved, "log_level") + s, err := resolved["log_level"].AsStringValue() + require.NoError(t, err) + assert.Equal(t, "error", s) +} + +// --------------------------------------------------------------------------- +// Variable Set tests — unrelated sets do not match +// --------------------------------------------------------------------------- + +func TestResolve_VariableSet_UnrelatedDoNotMatch(t *testing.T) { + scope := newScope() + scope.Resource.Metadata = map[string]string{"env": "staging"} + + getter := &mockGetter{ + deploymentVars: []oapi.DeploymentVariableWithValues{{ + Variable: oapi.DeploymentVariable{ + Id: uuid.New().String(), + DeploymentId: scope.Deployment.Id, + Key: "log_level", + }, + Values: []oapi.DeploymentVariableValue{}, + }}, + resourceVars: map[string]oapi.ResourceVariable{}, + variableSets: []oapi.VariableSetWithVariables{ + makeVariableSet("prod-only", `resource.metadata.env == "production"`, 1, map[string]string{ + "log_level": "warn", + }), + }, + } + + resolved, err := Resolve( + context.Background(), + getter, + scope, + scope.Deployment.Id, + scope.Resource.Id, + ) + require.NoError(t, err) + assert.NotContains(t, resolved, "log_level") +} diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts index adc070f7f..256853d5d 100644 --- a/packages/db/src/schema/index.ts +++ b/packages/db/src/schema/index.ts @@ -28,3 +28,4 @@ export * from "./policy-rule-summary.js"; export * from "./job-verification-metric.js"; export * from "./relationships.js"; export * from "./job-agent.js"; +export * from "./variable-set.js"; diff --git a/packages/db/src/schema/variable-set.ts b/packages/db/src/schema/variable-set.ts new file mode 100644 index 000000000..576b36b91 --- /dev/null +++ b/packages/db/src/schema/variable-set.ts @@ -0,0 +1,54 @@ +import type { InferSelectModel } from "drizzle-orm"; +import { + integer, + jsonb, + pgTable, + text, + timestamp, + unique, + uuid, +} from "drizzle-orm/pg-core"; + +import { workspace } from "./workspace.js"; + +export const variableSet = pgTable("variable_set", { + id: uuid("id").primaryKey().defaultRandom(), + name: text("name").notNull(), + description: text("description").notNull().default(""), + selector: text("selector").notNull(), + + metadata: jsonb("metadata") + .notNull() + .default("{}") + .$type>(), + + priority: integer("priority").notNull().default(0), + + workspaceId: uuid("workspace_id") + .notNull() + .references(() => workspace.id, { onDelete: "cascade" }), + createdAt: timestamp("created_at", { withTimezone: true }) + .notNull() + .defaultNow(), + updatedAt: timestamp("updated_at", { withTimezone: true }) + .notNull() + .defaultNow() + .$onUpdate(() => new Date()), +}); + +export type VariableSet = InferSelectModel; + +export const variableSetVariable = pgTable( + "variable_set_variable", + { + id: uuid("id").primaryKey().defaultRandom(), + variableSetId: uuid("variable_set_id") + .notNull() + .references(() => variableSet.id, { onDelete: "cascade" }), + key: text("key").notNull(), + value: jsonb("value").notNull(), + }, + (t) => [unique().on(t.variableSetId, t.key)], +); + +export type VariableSetVariable = InferSelectModel; From 4d8bee4251630c7bf606a18541ffe4a4ef005c8c Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 11:21:19 -0700 Subject: [PATCH 02/10] fix build --- .../svc/controllers/desiredrelease/reconcile_test.go | 11 ++++++++--- .../test/controllers/harness/mocks.go | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go b/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go index db9dd816f..753516e44 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go @@ -4,13 +4,14 @@ import ( "context" "testing" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" "workspace-engine/pkg/workspace/releasemanager/policy/evaluator" "workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression" + + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // --------------------------------------------------------------------------- @@ -221,6 +222,10 @@ func (m *mockReconcileGetter) GetJobsForEnvironmentAndVersion( return nil, nil } +func (m *mockReconcileGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { + return nil, nil +} + var _ Getter = (*mockReconcileGetter)(nil) // --------------------------------------------------------------------------- diff --git a/apps/workspace-engine/test/controllers/harness/mocks.go b/apps/workspace-engine/test/controllers/harness/mocks.go index 426f21a3d..71c99b544 100644 --- a/apps/workspace-engine/test/controllers/harness/mocks.go +++ b/apps/workspace-engine/test/controllers/harness/mocks.go @@ -7,7 +7,6 @@ import ( "sync" "time" - "github.com/google/uuid" "workspace-engine/pkg/celutil" "workspace-engine/pkg/oapi" "workspace-engine/pkg/policies/match" @@ -22,6 +21,8 @@ import ( "workspace-engine/svc/controllers/jobdispatch" "workspace-engine/svc/controllers/jobverificationmetric/metrics" "workspace-engine/svc/controllers/jobverificationmetric/metrics/provider" + + "github.com/google/uuid" ) var celEnv, _ = celutil.NewEnvBuilder(). @@ -462,6 +463,10 @@ func (g *DesiredReleaseGetter) GetJobsForEnvironmentAndVersion( return result, nil } +func (g *DesiredReleaseGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { + return nil, nil +} + type eligibilityCall struct { WorkspaceID string RT *desiredrelease.ReleaseTarget From adc3ce405457464a4bc22b48badfdeecae7e61dd Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 12:30:28 -0700 Subject: [PATCH 03/10] implement resolveFromVarSet --- apps/workspace-engine/oapi/openapi.json | 16 +-- .../oapi/spec/schemas/variablesets.jsonnet | 9 +- apps/workspace-engine/pkg/oapi/oapi.gen.go | 135 +----------------- .../variableresolver/resolve.go | 80 ++++++++++- .../variableresolver/resolve_test.go | 8 +- .../test/controllers/harness/mocks.go | 1 + 6 files changed, 81 insertions(+), 168 deletions(-) diff --git a/apps/workspace-engine/oapi/openapi.json b/apps/workspace-engine/oapi/openapi.json index 3871f96ae..952bd057b 100644 --- a/apps/workspace-engine/oapi/openapi.json +++ b/apps/workspace-engine/oapi/openapi.json @@ -2727,21 +2727,7 @@ "type": "string" }, "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - }, - { - "additionalProperties": true, - "type": "object" - } - ] + "$ref": "#/components/schemas/Value" }, "variableSetId": { "description": "The ID of the variable set this variable belongs to", diff --git a/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet b/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet index b6aabc1e6..2789c3181 100644 --- a/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet +++ b/apps/workspace-engine/oapi/spec/schemas/variablesets.jsonnet @@ -22,14 +22,7 @@ local openapi = import '../lib/openapi.libsonnet'; id: { type: 'string', format: 'uuid', description: 'The ID of the variable' }, variableSetId: { type: 'string', format: 'uuid', description: 'The ID of the variable set this variable belongs to' }, key: { type: 'string', description: 'The key of the variable, unique within the variable set' }, - value: { - oneOf: [ - { type: 'string' }, - { type: 'number' }, - { type: 'boolean' }, - { type: 'object', additionalProperties: true }, - ], - }, + value: openapi.schemaRef('Value'), }, }, diff --git a/apps/workspace-engine/pkg/oapi/oapi.gen.go b/apps/workspace-engine/pkg/oapi/oapi.gen.go index db0cc2387..bcf823837 100644 --- a/apps/workspace-engine/pkg/oapi/oapi.gen.go +++ b/apps/workspace-engine/pkg/oapi/oapi.gen.go @@ -1260,30 +1260,13 @@ type VariableSetVariable struct { Id openapi_types.UUID `json:"id"` // Key The key of the variable, unique within the variable set - Key string `json:"key"` - Value VariableSetVariable_Value `json:"value"` + Key string `json:"key"` + Value Value `json:"value"` // VariableSetId The ID of the variable set this variable belongs to VariableSetId openapi_types.UUID `json:"variableSetId"` } -// VariableSetVariableValue0 defines model for . -type VariableSetVariableValue0 = string - -// VariableSetVariableValue1 defines model for . -type VariableSetVariableValue1 = float32 - -// VariableSetVariableValue2 defines model for . -type VariableSetVariableValue2 = bool - -// VariableSetVariableValue3 defines model for . -type VariableSetVariableValue3 map[string]interface{} - -// VariableSetVariable_Value defines model for VariableSetVariable.Value. -type VariableSetVariable_Value struct { - union json.RawMessage -} - // VariableSetWithVariables defines model for VariableSetWithVariables. type VariableSetWithVariables struct { // CreatedAt The timestamp when the variable set was created @@ -2299,120 +2282,6 @@ func (t *Value) UnmarshalJSON(b []byte) error { return err } -// AsVariableSetVariableValue0 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue0 -func (t VariableSetVariable_Value) AsVariableSetVariableValue0() (VariableSetVariableValue0, error) { - var body VariableSetVariableValue0 - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromVariableSetVariableValue0 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue0 -func (t *VariableSetVariable_Value) FromVariableSetVariableValue0(v VariableSetVariableValue0) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeVariableSetVariableValue0 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue0 -func (t *VariableSetVariable_Value) MergeVariableSetVariableValue0(v VariableSetVariableValue0) error { - b, err := json.Marshal(v) - if err != nil { - return err - } - - merged, err := runtime.JSONMerge(t.union, b) - t.union = merged - return err -} - -// AsVariableSetVariableValue1 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue1 -func (t VariableSetVariable_Value) AsVariableSetVariableValue1() (VariableSetVariableValue1, error) { - var body VariableSetVariableValue1 - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromVariableSetVariableValue1 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue1 -func (t *VariableSetVariable_Value) FromVariableSetVariableValue1(v VariableSetVariableValue1) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeVariableSetVariableValue1 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue1 -func (t *VariableSetVariable_Value) MergeVariableSetVariableValue1(v VariableSetVariableValue1) error { - b, err := json.Marshal(v) - if err != nil { - return err - } - - merged, err := runtime.JSONMerge(t.union, b) - t.union = merged - return err -} - -// AsVariableSetVariableValue2 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue2 -func (t VariableSetVariable_Value) AsVariableSetVariableValue2() (VariableSetVariableValue2, error) { - var body VariableSetVariableValue2 - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromVariableSetVariableValue2 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue2 -func (t *VariableSetVariable_Value) FromVariableSetVariableValue2(v VariableSetVariableValue2) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeVariableSetVariableValue2 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue2 -func (t *VariableSetVariable_Value) MergeVariableSetVariableValue2(v VariableSetVariableValue2) error { - b, err := json.Marshal(v) - if err != nil { - return err - } - - merged, err := runtime.JSONMerge(t.union, b) - t.union = merged - return err -} - -// AsVariableSetVariableValue3 returns the union data inside the VariableSetVariable_Value as a VariableSetVariableValue3 -func (t VariableSetVariable_Value) AsVariableSetVariableValue3() (VariableSetVariableValue3, error) { - var body VariableSetVariableValue3 - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromVariableSetVariableValue3 overwrites any union data inside the VariableSetVariable_Value as the provided VariableSetVariableValue3 -func (t *VariableSetVariable_Value) FromVariableSetVariableValue3(v VariableSetVariableValue3) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeVariableSetVariableValue3 performs a merge with any union data inside the VariableSetVariable_Value, using the provided VariableSetVariableValue3 -func (t *VariableSetVariable_Value) MergeVariableSetVariableValue3(v VariableSetVariableValue3) error { - b, err := json.Marshal(v) - if err != nil { - return err - } - - merged, err := runtime.JSONMerge(t.union, b) - t.union = merged - return err -} - -func (t VariableSetVariable_Value) MarshalJSON() ([]byte, error) { - b, err := t.union.MarshalJSON() - return b, err -} - -func (t *VariableSetVariable_Value) UnmarshalJSON(b []byte) error { - err := t.union.UnmarshalJSON(b) - return err -} - // AsWorkflowManualArrayInput returns the union data inside the WorkflowArrayInput as a WorkflowManualArrayInput func (t WorkflowArrayInput) AsWorkflowManualArrayInput() (WorkflowManualArrayInput, error) { var body WorkflowManualArrayInput diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go index 1d4f02ffb..5277245b3 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go @@ -5,14 +5,16 @@ import ( "fmt" "sort" - "github.com/google/uuid" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" "workspace-engine/pkg/celutil" "workspace-engine/pkg/oapi" "workspace-engine/pkg/selector" + cel "workspace-engine/pkg/selector/langs/cel" "workspace-engine/pkg/workspace/relationships/eval" + + "github.com/google/uuid" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" ) func NewResourceEntity(resource *oapi.Resource) *oapi.RelatableEntity { @@ -78,6 +80,17 @@ func Resolve( return nil, fmt.Errorf("parse workspace id: %w", err) } + variableSets, err := getter.GetVariableSetsWithVariables(ctx, wsID) + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, "get variable sets with variables failed") + return nil, fmt.Errorf("get variable sets with variables: %w", err) + } + span.SetAttributes(attribute.Int("variable_sets.count", len(variableSets))) + + filteredVariableSets := filterVariableSets(scope, variableSets) + span.SetAttributes(attribute.Int("filtered_variable_sets.count", len(filteredVariableSets))) + rules, err := getter.GetRelationshipRules(ctx, wsID) if err != nil { span.RecordError(err) @@ -90,7 +103,7 @@ func Resolve( entity := NewResourceEntity(scope.Resource) resolved := make(map[string]oapi.LiteralValue, len(deploymentVars)) - var fromResource, fromValue, fromDefault int + var fromResource, fromValue, fromVariableSet, fromDefault int for _, dv := range deploymentVars { key := dv.Variable.Key @@ -121,6 +134,19 @@ func Resolve( continue } + if lv := resolveFromVariableSets( + ctx, + key, + filteredVariableSets, + resolver, + resourceID, + entity, + ); lv != nil { + resolved[key] = *lv + fromVariableSet++ + continue + } + if dv.Variable.DefaultValue != nil { resolved[key] = *dv.Variable.DefaultValue fromDefault++ @@ -131,6 +157,7 @@ func Resolve( attribute.Int("resolved.total", len(resolved)), attribute.Int("resolved.from_resource", fromResource), attribute.Int("resolved.from_value", fromValue), + attribute.Int("resolved.from_variable_set", fromVariableSet), attribute.Int("resolved.from_default", fromDefault), ) return resolved, nil @@ -277,6 +304,49 @@ func resolveFromValues( return nil } +func resolveFromVariableSets( + ctx context.Context, + key string, + variableSets []oapi.VariableSetWithVariables, + resolver RelatedEntityResolver, + resourceID string, + entity *oapi.RelatableEntity, +) *oapi.LiteralValue { + for _, vs := range variableSets { + for _, v := range vs.Variables { + if v.Key == key { + lv, err := ResolveValue(ctx, resolver, resourceID, entity, &v.Value) + if err == nil && lv != nil { + return lv + } + } + } + } + return nil +} + +func filterVariableSets( + scope *Scope, + variableSets []oapi.VariableSetWithVariables, +) []oapi.VariableSetWithVariables { + celCtx := cel.BuildEntityContext(scope.Resource, scope.Deployment, scope.Environment) + matched := make([]oapi.VariableSetWithVariables, 0, len(variableSets)) + for _, vs := range variableSets { + if vs.Selector == "" { + continue + } + program, err := cel.CompileProgram(vs.Selector) + if err != nil { + continue + } + result, _ := celutil.EvalBool(program, celCtx) + if result { + matched = append(matched, vs) + } + } + return matched +} + func entityDataToRelatableEntity(data *eval.EntityData) (*oapi.RelatableEntity, error) { entity := &oapi.RelatableEntity{} diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go index 01ae07746..3e93bde6c 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go @@ -976,12 +976,6 @@ func TestResolveValue_Sensitive_ReturnsError(t *testing.T) { // helpers — variable sets // --------------------------------------------------------------------------- -func newVariableSetValue(s string) oapi.VariableSetVariable_Value { - var v oapi.VariableSetVariable_Value - _ = v.FromVariableSetVariableValue0(s) - return v -} - func makeVariableSet( name, selector string, priority int64, @@ -994,7 +988,7 @@ func makeVariableSet( Id: uuid.New(), VariableSetId: vsID, Key: k, - Value: newVariableSetValue(val), + Value: literalStringValue(val), }) } return oapi.VariableSetWithVariables{ diff --git a/apps/workspace-engine/test/controllers/harness/mocks.go b/apps/workspace-engine/test/controllers/harness/mocks.go index 71c99b544..bda79921c 100644 --- a/apps/workspace-engine/test/controllers/harness/mocks.go +++ b/apps/workspace-engine/test/controllers/harness/mocks.go @@ -119,6 +119,7 @@ type DesiredReleaseGetter struct { DeploymentVars []oapi.DeploymentVariableWithValues ResourceVars map[string]oapi.ResourceVariable + VariableSets []oapi.VariableSetWithVariables RelationshipRules []eval.Rule Candidates map[string][]eval.EntityData From 142fcf8f646354db321c26d7b26c38adebf445d3 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 12:42:58 -0700 Subject: [PATCH 04/10] sort variable sets --- .../svc/controllers/desiredrelease/variableresolver/resolve.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go index 5277245b3..3f11a3620 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go @@ -344,6 +344,9 @@ func filterVariableSets( matched = append(matched, vs) } } + sort.Slice(matched, func(i, j int) bool { + return matched[i].Priority > matched[j].Priority + }) return matched } From c81d4b23fb4f02116f41fd8022afef5b22be37dc Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 13:28:52 -0700 Subject: [PATCH 05/10] add in queries --- apps/workspace-engine/pkg/db/convert.go | 33 + apps/workspace-engine/pkg/db/models.go | 19 + .../pkg/db/queries/schema.sql | 20 + .../pkg/db/queries/variable_sets.sql | 11 + apps/workspace-engine/pkg/db/sqlc.yaml | 11 + .../pkg/db/variable_sets.sql.go | 70 + .../variableresolver/getters_postgres.go | 10 +- .../db/drizzle/0182_silent_blazing_skull.sql | 22 + packages/db/drizzle/meta/0182_snapshot.json | 6429 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + 10 files changed, 6631 insertions(+), 1 deletion(-) create mode 100644 apps/workspace-engine/pkg/db/queries/variable_sets.sql create mode 100644 apps/workspace-engine/pkg/db/variable_sets.sql.go create mode 100644 packages/db/drizzle/0182_silent_blazing_skull.sql create mode 100644 packages/db/drizzle/meta/0182_snapshot.json diff --git a/apps/workspace-engine/pkg/db/convert.go b/apps/workspace-engine/pkg/db/convert.go index e24c09f0d..75bf6822b 100644 --- a/apps/workspace-engine/pkg/db/convert.go +++ b/apps/workspace-engine/pkg/db/convert.go @@ -323,6 +323,39 @@ func ToOapiDeploymentVariableValue(row DeploymentVariableValue) oapi.DeploymentV return v } +func ToOapiVariableSetWithVariables(row ListVariableSetsWithVariablesByWorkspaceIDRow) oapi.VariableSetWithVariables { + vs := oapi.VariableSetWithVariables{ + Id: row.ID, + Name: row.Name, + Description: row.Description, + Selector: row.Selector, + Priority: int64(row.Priority), + CreatedAt: row.CreatedAt.Time, + UpdatedAt: row.UpdatedAt.Time, + } + + type varJSON struct { + Id string `json:"id"` + VariableSetId string `json:"variableSetId"` + Key string `json:"key"` + Value json.RawMessage `json:"value"` + } + var varsRaw []varJSON + _ = json.Unmarshal(row.Variables, &varsRaw) + vs.Variables = make([]oapi.VariableSetVariable, 0, len(varsRaw)) + for _, v := range varsRaw { + var val oapi.Value + _ = val.UnmarshalJSON(v.Value) + vs.Variables = append(vs.Variables, oapi.VariableSetVariable{ + Id: uuid.MustParse(v.Id), + VariableSetId: uuid.MustParse(v.VariableSetId), + Key: v.Key, + Value: val, + }) + } + return vs +} + func ToOapiResourceVariable(row ResourceVariable) oapi.ResourceVariable { v := oapi.ResourceVariable{ ResourceId: row.ResourceID.String(), diff --git a/apps/workspace-engine/pkg/db/models.go b/apps/workspace-engine/pkg/db/models.go index e62c21ace..c4c129444 100644 --- a/apps/workspace-engine/pkg/db/models.go +++ b/apps/workspace-engine/pkg/db/models.go @@ -708,6 +708,25 @@ type UserApprovalRecord struct { CreatedAt pgtype.Timestamptz } +type VariableSet struct { + ID uuid.UUID + Name string + Description string + Selector string + Metadata map[string]string + Priority int32 + WorkspaceID uuid.UUID + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz +} + +type VariableSetVariable struct { + ID uuid.UUID + VariableSetID uuid.UUID + Key string + Value []byte +} + type Workflow struct { ID uuid.UUID Name string diff --git a/apps/workspace-engine/pkg/db/queries/schema.sql b/apps/workspace-engine/pkg/db/queries/schema.sql index 8a7ba63b3..e07376df8 100644 --- a/apps/workspace-engine/pkg/db/queries/schema.sql +++ b/apps/workspace-engine/pkg/db/queries/schema.sql @@ -496,4 +496,24 @@ CREATE TABLE deployment_plan_target_result ( message TEXT, started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), completed_at TIMESTAMPTZ +); + +CREATE TABLE variable_set ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + name TEXT NOT NULL, + description TEXT NOT NULL DEFAULT '', + selector TEXT NOT NULL, + metadata JSONB NOT NULL DEFAULT '{}', + priority INTEGER NOT NULL DEFAULT 0, + workspace_id UUID NOT NULL REFERENCES workspace(id) ON DELETE CASCADE, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE TABLE variable_set_variable ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + variable_set_id UUID NOT NULL REFERENCES variable_set(id) ON DELETE CASCADE, + key TEXT NOT NULL, + value JSONB NOT NULL, + UNIQUE (variable_set_id, key) ); \ No newline at end of file diff --git a/apps/workspace-engine/pkg/db/queries/variable_sets.sql b/apps/workspace-engine/pkg/db/queries/variable_sets.sql new file mode 100644 index 000000000..8c1b60c42 --- /dev/null +++ b/apps/workspace-engine/pkg/db/queries/variable_sets.sql @@ -0,0 +1,11 @@ +-- name: ListVariableSetsWithVariablesByWorkspaceID :many +SELECT + vs.id, vs.name, vs.description, vs.selector, vs.metadata, vs.priority, vs.workspace_id, vs.created_at, vs.updated_at, + COALESCE( + (SELECT json_agg(json_build_object('id', v.id, 'variableSetId', v.variable_set_id, 'key', v.key, 'value', v.value)) + FROM variable_set_variable v WHERE v.variable_set_id = vs.id), + '[]'::json + ) AS variables +FROM variable_set vs +WHERE vs.workspace_id = $1 +ORDER BY vs.priority DESC; diff --git a/apps/workspace-engine/pkg/db/sqlc.yaml b/apps/workspace-engine/pkg/db/sqlc.yaml index b54f6fdf2..a619b7100 100644 --- a/apps/workspace-engine/pkg/db/sqlc.yaml +++ b/apps/workspace-engine/pkg/db/sqlc.yaml @@ -32,6 +32,7 @@ sql: - queries/policy_rule_evaluation.sql - queries/deployment_plan.sql - queries/release_targets.sql + - queries/variable_sets.sql database: uri: "postgresql://ctrlplane:ctrlplane@127.0.0.1:5432/ctrlplane?sslmode=disable" gen: @@ -142,6 +143,16 @@ sql: go_type: type: "[]byte" + # VariableSet + - column: "variable_set.metadata" + go_type: + type: "map[string]string" + + # VariableSetVariable + - column: "variable_set_variable.value" + go_type: + type: "[]byte" + # DeploymentVariable - column: "deployment_variable.default_value" go_type: diff --git a/apps/workspace-engine/pkg/db/variable_sets.sql.go b/apps/workspace-engine/pkg/db/variable_sets.sql.go new file mode 100644 index 000000000..599f2b5a9 --- /dev/null +++ b/apps/workspace-engine/pkg/db/variable_sets.sql.go @@ -0,0 +1,70 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.30.0 +// source: variable_sets.sql + +package db + +import ( + "context" + + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" +) + +const listVariableSetsWithVariablesByWorkspaceID = `-- name: ListVariableSetsWithVariablesByWorkspaceID :many +SELECT + vs.id, vs.name, vs.description, vs.selector, vs.metadata, vs.priority, vs.workspace_id, vs.created_at, vs.updated_at, + COALESCE( + (SELECT json_agg(json_build_object('id', v.id, 'variableSetId', v.variable_set_id, 'key', v.key, 'value', v.value)) + FROM variable_set_variable v WHERE v.variable_set_id = vs.id), + '[]'::json + ) AS variables +FROM variable_set vs +WHERE vs.workspace_id = $1 +ORDER BY vs.priority DESC +` + +type ListVariableSetsWithVariablesByWorkspaceIDRow struct { + ID uuid.UUID + Name string + Description string + Selector string + Metadata map[string]string + Priority int32 + WorkspaceID uuid.UUID + CreatedAt pgtype.Timestamptz + UpdatedAt pgtype.Timestamptz + Variables []byte +} + +func (q *Queries) ListVariableSetsWithVariablesByWorkspaceID(ctx context.Context, workspaceID uuid.UUID) ([]ListVariableSetsWithVariablesByWorkspaceIDRow, error) { + rows, err := q.db.Query(ctx, listVariableSetsWithVariablesByWorkspaceID, workspaceID) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListVariableSetsWithVariablesByWorkspaceIDRow + for rows.Next() { + var i ListVariableSetsWithVariablesByWorkspaceIDRow + if err := rows.Scan( + &i.ID, + &i.Name, + &i.Description, + &i.Selector, + &i.Metadata, + &i.Priority, + &i.WorkspaceID, + &i.CreatedAt, + &i.UpdatedAt, + &i.Variables, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go index a441d1c38..d3eae0496 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go @@ -162,7 +162,15 @@ func (g *PostgresGetter) GetResourceVariables( } func (g *PostgresGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { - return nil, nil + rows, err := db.GetQueries(ctx).ListVariableSetsWithVariablesByWorkspaceID(ctx, workspaceID) + if err != nil { + return nil, fmt.Errorf("list variable sets with variables for workspace %s: %w", workspaceID, err) + } + result := make([]oapi.VariableSetWithVariables, 0, len(rows)) + for _, row := range rows { + result = append(result, db.ToOapiVariableSetWithVariables(row)) + } + return result, nil } func (g *PostgresGetter) GetRelationshipRules( diff --git a/packages/db/drizzle/0182_silent_blazing_skull.sql b/packages/db/drizzle/0182_silent_blazing_skull.sql new file mode 100644 index 000000000..c35dddd63 --- /dev/null +++ b/packages/db/drizzle/0182_silent_blazing_skull.sql @@ -0,0 +1,22 @@ +CREATE TABLE "variable_set" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text NOT NULL, + "description" text DEFAULT '' NOT NULL, + "selector" text NOT NULL, + "metadata" jsonb DEFAULT '{}' NOT NULL, + "priority" integer DEFAULT 0 NOT NULL, + "workspace_id" uuid NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "variable_set_variable" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "variable_set_id" uuid NOT NULL, + "key" text NOT NULL, + "value" jsonb NOT NULL, + CONSTRAINT "variable_set_variable_variable_set_id_key_unique" UNIQUE("variable_set_id","key") +); +--> statement-breakpoint +ALTER TABLE "variable_set" ADD CONSTRAINT "variable_set_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "variable_set_variable" ADD CONSTRAINT "variable_set_variable_variable_set_id_variable_set_id_fk" FOREIGN KEY ("variable_set_id") REFERENCES "public"."variable_set"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0182_snapshot.json b/packages/db/drizzle/meta/0182_snapshot.json new file mode 100644 index 000000000..f3d8c1307 --- /dev/null +++ b/packages/db/drizzle/meta/0182_snapshot.json @@ -0,0 +1,6429 @@ +{ + "id": "eae8306d-202e-45ca-a40b-206f318227ce", + "prevId": "d4d8f723-8996-465a-bf98-c51d8513ef1b", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "account_id": { + "name": "account_id", + "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 + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "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 + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_session_token_unique": { + "name": "session_session_token_unique", + "nullsNotDistinct": false, + "columns": ["session_token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": 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()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_api_key_key_prefix_key_hash_index": { + "name": "user_api_key_key_prefix_key_hash_index", + "columns": [ + { + "expression": "key_prefix", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.changelog_entry": { + "name": "changelog_entry", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_data": { + "name": "entity_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_entry_workspace_id_workspace_id_fk": { + "name": "changelog_entry_workspace_id_workspace_id_fk", + "tableFrom": "changelog_entry", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "changelog_entry_workspace_id_entity_type_entity_id_pk": { + "name": "changelog_entry_workspace_id_entity_type_entity_id_pk", + "columns": ["workspace_id", "entity_type", "entity_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan": { + "name": "deployment_plan", + "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 + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_tag": { + "name": "version_tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_name": { + "name": "version_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_config": { + "name": "version_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "version_job_agent_config": { + "name": "version_job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "version_metadata": { + "name": "version_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_plan_workspace_id_index": { + "name": "deployment_plan_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_deployment_id_index": { + "name": "deployment_plan_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_expires_at_index": { + "name": "deployment_plan_expires_at_index", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_workspace_id_workspace_id_fk": { + "name": "deployment_plan_workspace_id_workspace_id_fk", + "tableFrom": "deployment_plan", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_deployment_id_deployment_id_fk": { + "name": "deployment_plan_deployment_id_deployment_id_fk", + "tableFrom": "deployment_plan", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target": { + "name": "deployment_plan_target", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "plan_id": { + "name": "plan_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "current_release_id": { + "name": "current_release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_plan_target_plan_id_index": { + "name": "deployment_plan_target_plan_id_index", + "columns": [ + { + "expression": "plan_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_target_plan_id_environment_id_resource_id_index": { + "name": "deployment_plan_target_plan_id_environment_id_resource_id_index", + "columns": [ + { + "expression": "plan_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_plan_id_deployment_plan_id_fk": { + "name": "deployment_plan_target_plan_id_deployment_plan_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "deployment_plan", + "columnsFrom": ["plan_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_environment_id_environment_id_fk": { + "name": "deployment_plan_target_environment_id_environment_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_resource_id_resource_id_fk": { + "name": "deployment_plan_target_resource_id_resource_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_current_release_id_release_id_fk": { + "name": "deployment_plan_target_current_release_id_release_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "release", + "columnsFrom": ["current_release_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target_result": { + "name": "deployment_plan_target_result", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "dispatch_context": { + "name": "dispatch_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "agent_state": { + "name": "agent_state", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "deployment_plan_target_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'computing'" + }, + "has_changes": { + "name": "has_changes", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "current": { + "name": "current", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "proposed": { + "name": "proposed", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_plan_target_result_target_id_index": { + "name": "deployment_plan_target_result_target_id_index", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_result_target_id_deployment_plan_target_id_fk": { + "name": "deployment_plan_target_result_target_id_deployment_plan_target_id_fk", + "tableFrom": "deployment_plan_target_result", + "tableTo": "deployment_plan_target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target_variable": { + "name": "deployment_plan_target_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_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 + }, + "encrypted": { + "name": "encrypted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "deployment_plan_target_variable_target_id_key_index": { + "name": "deployment_plan_target_variable_target_id_key_index", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk": { + "name": "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk", + "tableFrom": "deployment_plan_target_variable", + "tableTo": "deployment_plan_target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_trace_span": { + "name": "deployment_trace_span", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "trace_id": { + "name": "trace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "span_id": { + "name": "span_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_span_id": { + "name": "parent_span_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_target_key": { + "name": "release_target_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "release_id": { + "name": "release_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_trace_id": { + "name": "parent_trace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phase": { + "name": "phase", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "node_type": { + "name": "node_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "depth": { + "name": "depth", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "attributes": { + "name": "attributes", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "events": { + "name": "events", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "deployment_trace_span_trace_span_idx": { + "name": "deployment_trace_span_trace_span_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "span_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_trace_id_idx": { + "name": "deployment_trace_span_trace_id_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_parent_span_id_idx": { + "name": "deployment_trace_span_parent_span_id_idx", + "columns": [ + { + "expression": "parent_span_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_workspace_id_idx": { + "name": "deployment_trace_span_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_release_target_key_idx": { + "name": "deployment_trace_span_release_target_key_idx", + "columns": [ + { + "expression": "release_target_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_release_id_idx": { + "name": "deployment_trace_span_release_id_idx", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_job_id_idx": { + "name": "deployment_trace_span_job_id_idx", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_parent_trace_id_idx": { + "name": "deployment_trace_span_parent_trace_id_idx", + "columns": [ + { + "expression": "parent_trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_created_at_idx": { + "name": "deployment_trace_span_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_phase_idx": { + "name": "deployment_trace_span_phase_idx", + "columns": [ + { + "expression": "phase", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_node_type_idx": { + "name": "deployment_trace_span_node_type_idx", + "columns": [ + { + "expression": "node_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_status_idx": { + "name": "deployment_trace_span_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_trace_span_workspace_id_workspace_id_fk": { + "name": "deployment_trace_span_workspace_id_workspace_id_fk", + "tableFrom": "deployment_trace_span", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_value": { + "name": "default_value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_index": { + "name": "deployment_variable_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "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" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "deployment_variable_deployment_id_key_unique": { + "name": "deployment_variable_deployment_id_key_unique", + "nullsNotDistinct": false, + "columns": ["deployment_id", "key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_variable_id": { + "name": "deployment_variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "priority": { + "name": "priority", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "deployment_variable_value_deployment_variable_id_index": { + "name": "deployment_variable_value_deployment_variable_id_index", + "columns": [ + { + "expression": "deployment_variable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk": { + "name": "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk", + "tableFrom": "deployment_variable_value", + "tableTo": "deployment_variable", + "columnsFrom": ["deployment_variable_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_version": { + "name": "deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "deployment_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'ready'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "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_workspace_id_workspace_id_fk": { + "name": "deployment_version_workspace_id_workspace_id_fk", + "tableFrom": "deployment_version", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_deployment_resource": { + "name": "computed_deployment_resource", + "schema": "", + "columns": { + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "computed_deployment_resource_deployment_id_deployment_id_fk": { + "name": "computed_deployment_resource_deployment_id_deployment_id_fk", + "tableFrom": "computed_deployment_resource", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_deployment_resource_resource_id_resource_id_fk": { + "name": "computed_deployment_resource_resource_id_resource_id_fk", + "tableFrom": "computed_deployment_resource", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_deployment_resource_deployment_id_resource_id_pk": { + "name": "computed_deployment_resource_deployment_id_resource_id_pk", + "columns": ["deployment_id", "resource_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "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": "'{}'" + }, + "job_agents": { + "name": "job_agents", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_workspace_id_index": { + "name": "deployment_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_workspace_id_workspace_id_fk": { + "name": "deployment_workspace_id_workspace_id_fk", + "tableFrom": "deployment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_environment_resource": { + "name": "computed_environment_resource", + "schema": "", + "columns": { + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "computed_environment_resource_environment_id_environment_id_fk": { + "name": "computed_environment_resource_environment_id_environment_id_fk", + "tableFrom": "computed_environment_resource", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_environment_resource_resource_id_resource_id_fk": { + "name": "computed_environment_resource_resource_id_resource_id_fk", + "tableFrom": "computed_environment_resource", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_environment_resource_environment_id_resource_id_pk": { + "name": "computed_environment_resource_environment_id_resource_id_pk", + "columns": ["environment_id", "resource_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "environment_workspace_id_index": { + "name": "environment_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_workspace_id_workspace_id_fk": { + "name": "environment_workspace_id_workspace_id_fk", + "tableFrom": "environment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event": { + "name": "event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "event_workspace_id_workspace_id_fk": { + "name": "event_workspace_id_workspace_id_fk", + "tableFrom": "event", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "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": {} + }, + "resource_workspace_id_active_idx": { + "name": "resource_workspace_id_active_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_workspace_id_deleted_at_index": { + "name": "resource_workspace_id_deleted_at_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource", + "tableTo": "resource_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_workspace_id_workspace_id_fk": { + "name": "resource_workspace_id_workspace_id_fk", + "tableFrom": "resource", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_aggregate": { + "name": "resource_aggregate", + "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": 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 + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "filter": { + "name": "filter", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'true'" + }, + "group_by": { + "name": "group_by", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resource_aggregate_workspace_id_index": { + "name": "resource_aggregate_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_aggregate_workspace_id_workspace_id_fk": { + "name": "resource_aggregate_workspace_id_workspace_id_fk", + "tableFrom": "resource_aggregate", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "resource_aggregate_created_by_user_id_fk": { + "name": "resource_aggregate_created_by_user_id_fk", + "tableFrom": "resource_aggregate", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_schema": { + "name": "resource_schema", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "json_schema": { + "name": "json_schema", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "resource_schema_version_kind_workspace_id_index": { + "name": "resource_schema_version_kind_workspace_id_index", + "columns": [ + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_schema_workspace_id_workspace_id_fk": { + "name": "resource_schema_workspace_id_workspace_id_fk", + "tableFrom": "resource_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_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 with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "resource_provider_workspace_id_name_index": { + "name": "resource_provider_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_workspace_id_workspace_id_fk": { + "name": "resource_provider_workspace_id_workspace_id_fk", + "tableFrom": "resource_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "system_workspace_id_index": { + "name": "system_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.system_deployment": { + "name": "system_deployment", + "schema": "", + "columns": { + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "system_deployment_system_id_system_id_fk": { + "name": "system_deployment_system_id_system_id_fk", + "tableFrom": "system_deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "system_deployment_deployment_id_deployment_id_fk": { + "name": "system_deployment_deployment_id_deployment_id_fk", + "tableFrom": "system_deployment", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "system_deployment_system_id_deployment_id_pk": { + "name": "system_deployment_system_id_deployment_id_pk", + "columns": ["system_id", "deployment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.system_environment": { + "name": "system_environment", + "schema": "", + "columns": { + "system_id": { + "name": "system_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 with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "system_environment_system_id_system_id_fk": { + "name": "system_environment_system_id_system_id_fk", + "tableFrom": "system_environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "system_environment_environment_id_environment_id_fk": { + "name": "system_environment_environment_id_environment_id_fk", + "tableFrom": "system_environment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "system_environment_system_id_environment_id_pk": { + "name": "system_environment_system_id_environment_id_pk", + "columns": ["system_id", "environment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": [ + { + "expression": "team_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job": { + "name": "job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "trace_token": { + "name": "trace_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dispatch_context": { + "name": "dispatch_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "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": {} + }, + "job_external_id_idx": { + "name": "job_external_id_idx", + "columns": [ + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_job_agent_id_job_agent_id_fk": { + "name": "job_job_agent_id_job_agent_id_fk", + "tableFrom": "job", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_metadata": { + "name": "job_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_metadata_key_job_id_index": { + "name": "job_metadata_key_job_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_metadata_job_id_idx": { + "name": "job_metadata_job_id_idx", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_metadata_job_id_job_id_fk": { + "name": "job_metadata_job_id_job_id_fk", + "tableFrom": "job_metadata", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_variable": { + "name": "job_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "job_variable_job_id_key_index": { + "name": "job_variable_job_id_key_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_variable_job_id_job_id_fk": { + "name": "job_variable_job_id_job_id_fk", + "tableFrom": "job_variable", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_email_domain_matching": { + "name": "workspace_email_domain_matching", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "verification_code": { + "name": "verification_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verification_email": { + "name": "verification_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_email_domain_matching_workspace_id_domain_index": { + "name": "workspace_email_domain_matching_workspace_id_domain_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_email_domain_matching_workspace_id_workspace_id_fk": { + "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_email_domain_matching_role_id_role_id_fk": { + "name": "workspace_email_domain_matching_role_id_role_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_invite_token": { + "name": "workspace_invite_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_invite_token_role_id_role_id_fk": { + "name": "workspace_invite_token_role_id_role_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_workspace_id_workspace_id_fk": { + "name": "workspace_invite_token_workspace_id_workspace_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_created_by_user_id_fk": { + "name": "workspace_invite_token_created_by_user_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_token_token_unique": { + "name": "workspace_invite_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entity_role": { + "name": "entity_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "scope_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": { + "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "entity_role_role_id_role_id_fk": { + "name": "entity_role_role_id_role_id_fk", + "tableFrom": "entity_role", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "role_workspace_id_workspace_id_fk": { + "name": "role_workspace_id_workspace_id_fk", + "tableFrom": "role", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permission": { + "name": "role_permission", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "role_permission_role_id_permission_index": { + "name": "role_permission_role_id_permission_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "role_permission_role_id_role_id_fk": { + "name": "role_permission_role_id_role_id_fk", + "tableFrom": "role_permission", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release": { + "name": "release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_resource_id_environment_id_deployment_id_index": { + "name": "release_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_deployment_id_index": { + "name": "release_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_resource_id_resource_id_fk": { + "name": "release_resource_id_resource_id_fk", + "tableFrom": "release", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_environment_id_environment_id_fk": { + "name": "release_environment_id_environment_id_fk", + "tableFrom": "release", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_deployment_id_deployment_id_fk": { + "name": "release_deployment_id_deployment_id_fk", + "tableFrom": "release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_version_id_deployment_version_id_fk": { + "name": "release_version_id_deployment_version_id_fk", + "tableFrom": "release", + "tableTo": "deployment_version", + "columnsFrom": ["version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_job": { + "name": "release_job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "release_job_release_id_job_id_index": { + "name": "release_job_release_id_job_id_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_job_job_id_index": { + "name": "release_job_job_id_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_job_release_id_index": { + "name": "release_job_release_id_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_job_job_id_job_id_fk": { + "name": "release_job_job_id_job_id_fk", + "tableFrom": "release_job", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_job_release_id_release_id_fk": { + "name": "release_job_release_id_release_id_fk", + "tableFrom": "release_job", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_target_desired_release": { + "name": "release_target_desired_release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "desired_release_id": { + "name": "desired_release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "release_target_desired_release_resource_id_environment_id_deployment_id_index": { + "name": "release_target_desired_release_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_target_desired_release_resource_id_resource_id_fk": { + "name": "release_target_desired_release_resource_id_resource_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_environment_id_environment_id_fk": { + "name": "release_target_desired_release_environment_id_environment_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_deployment_id_deployment_id_fk": { + "name": "release_target_desired_release_deployment_id_deployment_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_desired_release_id_release_id_fk": { + "name": "release_target_desired_release_desired_release_id_release_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "release", + "columnsFrom": ["desired_release_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_variable": { + "name": "release_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "encrypted": { + "name": "encrypted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_variable_release_id_key_index": { + "name": "release_variable_release_id_key_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_variable_release_id_release_id_fk": { + "name": "release_variable_release_id_release_id_fk", + "tableFrom": "release_variable", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.reconcile_work_scope": { + "name": "reconcile_work_scope", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "reconcile_work_scope_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "scope_id": { + "name": "scope_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "event_ts": { + "name": "event_ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "priority": { + "name": "priority", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 100 + }, + "not_before": { + "name": "not_before", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "attempt_count": { + "name": "attempt_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "claimed_by": { + "name": "claimed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "claimed_until": { + "name": "claimed_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index": { + "name": "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "reconcile_work_scope_unclaimed_idx": { + "name": "reconcile_work_scope_unclaimed_idx", + "columns": [ + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "priority", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_ts", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"reconcile_work_scope\".\"claimed_until\" is null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "reconcile_work_scope_expired_claims_idx": { + "name": "reconcile_work_scope_expired_claims_idx", + "columns": [ + { + "expression": "claimed_until", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"reconcile_work_scope\".\"claimed_until\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy": { + "name": "policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'true'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": 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()" + } + }, + "indexes": { + "policy_workspace_id_index": { + "name": "policy_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "policy_workspace_id_workspace_id_fk": { + "name": "policy_workspace_id_workspace_id_fk", + "tableFrom": "policy", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_any_approval": { + "name": "policy_rule_any_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "min_approvals": { + "name": "min_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_any_approval_policy_id_policy_id_fk": { + "name": "policy_rule_any_approval_policy_id_policy_id_fk", + "tableFrom": "policy_rule_any_approval", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_deployment_dependency": { + "name": "policy_rule_deployment_dependency", + "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 + }, + "depends_on": { + "name": "depends_on", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_deployment_dependency_policy_id_policy_id_fk": { + "name": "policy_rule_deployment_dependency_policy_id_policy_id_fk", + "tableFrom": "policy_rule_deployment_dependency", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_deployment_window": { + "name": "policy_rule_deployment_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 + }, + "allow_window": { + "name": "allow_window", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rrule": { + "name": "rrule", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_deployment_window_policy_id_policy_id_fk": { + "name": "policy_rule_deployment_window_policy_id_policy_id_fk", + "tableFrom": "policy_rule_deployment_window", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_environment_progression": { + "name": "policy_rule_environment_progression", + "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 + }, + "depends_on_environment_selector": { + "name": "depends_on_environment_selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "maximum_age_hours": { + "name": "maximum_age_hours", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "minimum_soak_time_minutes": { + "name": "minimum_soak_time_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "minimum_success_percentage": { + "name": "minimum_success_percentage", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "success_statuses": { + "name": "success_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_environment_progression_policy_id_policy_id_fk": { + "name": "policy_rule_environment_progression_policy_id_policy_id_fk", + "tableFrom": "policy_rule_environment_progression", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_gradual_rollout": { + "name": "policy_rule_gradual_rollout", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rollout_type": { + "name": "rollout_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "time_scale_interval": { + "name": "time_scale_interval", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_gradual_rollout_policy_id_policy_id_fk": { + "name": "policy_rule_gradual_rollout_policy_id_policy_id_fk", + "tableFrom": "policy_rule_gradual_rollout", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_retry": { + "name": "policy_rule_retry", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "max_retries": { + "name": "max_retries", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "backoff_seconds": { + "name": "backoff_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "backoff_strategy": { + "name": "backoff_strategy", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_backoff_seconds": { + "name": "max_backoff_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "retry_on_statuses": { + "name": "retry_on_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_retry_policy_id_policy_id_fk": { + "name": "policy_rule_retry_policy_id_policy_id_fk", + "tableFrom": "policy_rule_retry", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_rollback": { + "name": "policy_rule_rollback", + "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 + }, + "on_job_statuses": { + "name": "on_job_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "on_verification_failure": { + "name": "on_verification_failure", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_rollback_policy_id_policy_id_fk": { + "name": "policy_rule_rollback_policy_id_policy_id_fk", + "tableFrom": "policy_rule_rollback", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_verification": { + "name": "policy_rule_verification", + "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 + }, + "metrics": { + "name": "metrics", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "trigger_on": { + "name": "trigger_on", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_verification_policy_id_policy_id_fk": { + "name": "policy_rule_verification_policy_id_policy_id_fk", + "tableFrom": "policy_rule_verification", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_version_cooldown": { + "name": "policy_rule_version_cooldown", + "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 + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_version_cooldown_policy_id_policy_id_fk": { + "name": "policy_rule_version_cooldown_policy_id_policy_id_fk", + "tableFrom": "policy_rule_version_cooldown", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_version_selector": { + "name": "policy_rule_version_selector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_version_selector_policy_id_policy_id_fk": { + "name": "policy_rule_version_selector_policy_id_policy_id_fk", + "tableFrom": "policy_rule_version_selector", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_approval_record": { + "name": "user_approval_record", + "schema": "", + "columns": { + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "user_approval_record_version_id_user_id_environment_id_pk": { + "name": "user_approval_record_version_id_user_id_environment_id_pk", + "columns": ["version_id", "user_id", "environment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_variable": { + "name": "resource_variable", + "schema": "", + "columns": { + "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 + } + }, + "indexes": {}, + "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": { + "resource_variable_resource_id_key_pk": { + "name": "resource_variable_resource_id_key_pk", + "columns": ["resource_id", "key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow": { + "name": "workflow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inputs": { + "name": "inputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "job_agents": { + "name": "job_agents", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_workspace_id_workspace_id_fk": { + "name": "workflow_workspace_id_workspace_id_fk", + "tableFrom": "workflow", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_job": { + "name": "workflow_job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workflow_run_id": { + "name": "workflow_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_job_workflow_run_id_workflow_run_id_fk": { + "name": "workflow_job_workflow_run_id_workflow_run_id_fk", + "tableFrom": "workflow_job", + "tableTo": "workflow_run", + "columnsFrom": ["workflow_run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_job_job_id_job_id_fk": { + "name": "workflow_job_job_id_job_id_fk", + "tableFrom": "workflow_job", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_run": { + "name": "workflow_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workflow_id": { + "name": "workflow_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "inputs": { + "name": "inputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_run_workflow_id_workflow_id_fk": { + "name": "workflow_run_workflow_id_workflow_id_fk", + "tableFrom": "workflow_run", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_skip": { + "name": "policy_skip", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_policy_release_target": { + "name": "computed_policy_release_target", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "computed_at": { + "name": "computed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index": { + "name": "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_policy_release_target_policy_id_index": { + "name": "computed_policy_release_target_policy_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_policy_release_target_resource_id_environment_id_deployment_id_index": { + "name": "computed_policy_release_target_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "computed_policy_release_target_policy_id_policy_id_fk": { + "name": "computed_policy_release_target_policy_id_policy_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_environment_id_environment_id_fk": { + "name": "computed_policy_release_target_environment_id_environment_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_deployment_id_deployment_id_fk": { + "name": "computed_policy_release_target_deployment_id_deployment_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_resource_id_resource_id_fk": { + "name": "computed_policy_release_target_resource_id_resource_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_evaluation": { + "name": "policy_rule_evaluation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "rule_type": { + "name": "rule_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "allowed": { + "name": "allowed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "action_required": { + "name": "action_required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "action_type": { + "name": "action_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "details": { + "name": "details", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "satisfied_at": { + "name": "satisfied_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "next_evaluation_at": { + "name": "next_evaluation_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index": { + "name": "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index", + "columns": [ + { + "expression": "rule_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index": { + "name": "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index", + "columns": [ + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rule_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "policy_rule_evaluation_environment_id_environment_id_fk": { + "name": "policy_rule_evaluation_environment_id_environment_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "policy_rule_evaluation_version_id_deployment_version_id_fk": { + "name": "policy_rule_evaluation_version_id_deployment_version_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "deployment_version", + "columnsFrom": ["version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "policy_rule_evaluation_resource_id_resource_id_fk": { + "name": "policy_rule_evaluation_resource_id_resource_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_verification_metric_measurement": { + "name": "job_verification_metric_measurement", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_verification_metric_status_id": { + "name": "job_verification_metric_status_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "measured_at": { + "name": "measured_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "status": { + "name": "status", + "type": "job_verification_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_verification_metric_measurement_job_verification_metric_status_id_index": { + "name": "job_verification_metric_measurement_job_verification_metric_status_id_index", + "columns": [ + { + "expression": "job_verification_metric_status_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk": { + "name": "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk", + "tableFrom": "job_verification_metric_measurement", + "tableTo": "job_verification_metric", + "columnsFrom": ["job_verification_metric_status_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_verification_metric": { + "name": "job_verification_metric", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "policy_rule_verification_metric_id": { + "name": "policy_rule_verification_metric_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "success_threshold": { + "name": "success_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_condition": { + "name": "failure_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "failure_threshold": { + "name": "failure_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + } + }, + "indexes": { + "job_verification_metric_job_id_index": { + "name": "job_verification_metric_job_id_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_verification_metric_policy_rule_verification_metric_id_index": { + "name": "job_verification_metric_policy_rule_verification_metric_id_index", + "columns": [ + { + "expression": "policy_rule_verification_metric_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk": { + "name": "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk", + "tableFrom": "job_verification_metric", + "tableTo": "policy_rule_job_verification_metric", + "columnsFrom": ["policy_rule_verification_metric_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_job_verification_metric": { + "name": "policy_rule_job_verification_metric", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "trigger_on": { + "name": "trigger_on", + "type": "job_verification_trigger_on", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'jobSuccess'" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "success_threshold": { + "name": "success_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_condition": { + "name": "failure_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "failure_threshold": { + "name": "failure_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_job_verification_metric_policy_id_policy_id_fk": { + "name": "policy_rule_job_verification_metric_policy_id_policy_id_fk", + "tableFrom": "policy_rule_job_verification_metric", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_entity_relationship": { + "name": "computed_entity_relationship", + "schema": "", + "columns": { + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "from_entity_type": { + "name": "from_entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_entity_id": { + "name": "from_entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "to_entity_type": { + "name": "to_entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "to_entity_id": { + "name": "to_entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "computed_entity_relationship_from_idx": { + "name": "computed_entity_relationship_from_idx", + "columns": [ + { + "expression": "from_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "from_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_entity_relationship_to_idx": { + "name": "computed_entity_relationship_to_idx", + "columns": [ + { + "expression": "to_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "to_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "computed_entity_relationship_rule_id_relationship_rule_id_fk": { + "name": "computed_entity_relationship_rule_id_relationship_rule_id_fk", + "tableFrom": "computed_entity_relationship", + "tableTo": "relationship_rule", + "columnsFrom": ["rule_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk": { + "name": "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk", + "columns": [ + "rule_id", + "from_entity_type", + "from_entity_id", + "to_entity_type", + "to_entity_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.relationship_rule": { + "name": "relationship_rule", + "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": true + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cel": { + "name": "cel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + } + }, + "indexes": { + "relationship_rule_workspace_id_reference_index": { + "name": "relationship_rule_workspace_id_reference_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "reference", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "relationship_rule_workspace_id_index": { + "name": "relationship_rule_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "relationship_rule_workspace_id_workspace_id_fk": { + "name": "relationship_rule_workspace_id_workspace_id_fk", + "tableFrom": "relationship_rule", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_agent": { + "name": "job_agent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "job_agent_workspace_id_name_index": { + "name": "job_agent_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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": true, + "default": "''" + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "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": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "variable_set_workspace_id_workspace_id_fk": { + "name": "variable_set_workspace_id_workspace_id_fk", + "tableFrom": "variable_set", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.variable_set_variable": { + "name": "variable_set_variable", + "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": {}, + "foreignKeys": { + "variable_set_variable_variable_set_id_variable_set_id_fk": { + "name": "variable_set_variable_variable_set_id_variable_set_id_fk", + "tableFrom": "variable_set_variable", + "tableTo": "variable_set", + "columnsFrom": ["variable_set_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "variable_set_variable_variable_set_id_key_unique": { + "name": "variable_set_variable_variable_set_id_key_unique", + "nullsNotDistinct": false, + "columns": ["variable_set_id", "key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.system_role": { + "name": "system_role", + "schema": "public", + "values": ["user", "admin"] + }, + "public.deployment_plan_target_status": { + "name": "deployment_plan_target_status", + "schema": "public", + "values": ["computing", "completed", "errored", "unsupported"] + }, + "public.deployment_version_status": { + "name": "deployment_version_status", + "schema": "public", + "values": [ + "unspecified", + "building", + "ready", + "failed", + "rejected", + "paused" + ] + }, + "public.job_reason": { + "name": "job_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override", + "redeploy" + ] + }, + "public.job_status": { + "name": "job_status", + "schema": "public", + "values": [ + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found", + "successful" + ] + }, + "public.entity_type": { + "name": "entity_type", + "schema": "public", + "values": ["user", "team"] + }, + "public.scope_type": { + "name": "scope_type", + "schema": "public", + "values": [ + "deploymentVersion", + "resource", + "resourceProvider", + "workspace", + "environment", + "system", + "deployment" + ] + }, + "public.job_verification_status": { + "name": "job_verification_status", + "schema": "public", + "values": ["failed", "inconclusive", "passed"] + }, + "public.job_verification_trigger_on": { + "name": "job_verification_trigger_on", + "schema": "public", + "values": ["jobCreated", "jobStarted", "jobSuccess", "jobFailure"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 8424ec0ad..7f3187517 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -1275,6 +1275,13 @@ "when": 1774151936030, "tag": "0181_wild_doctor_spectrum", "breakpoints": true + }, + { + "idx": 182, + "version": "7", + "when": 1775072628660, + "tag": "0182_silent_blazing_skull", + "breakpoints": true } ] } From 48e29a3f802f71fde253df70d1af620585dcee4f Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 14:44:43 -0700 Subject: [PATCH 06/10] wire in --- apps/api/openapi/main.jsonnet | 6 +- apps/api/openapi/openapi.json | 462 ++++++++++++++++++ apps/api/openapi/paths/variablesets.jsonnet | 87 ++++ apps/api/openapi/schemas/variablesets.jsonnet | 62 +++ apps/api/src/routes/v1/workspaces/index.ts | 4 +- .../src/routes/v1/workspaces/variable-sets.ts | 180 +++++++ apps/api/src/types/openapi.ts | 301 ++++++++++++ apps/workspace-engine/pkg/db/convert.go | 16 +- .../desiredrelease/reconcile_test.go | 12 +- .../variableresolver/getters.go | 8 +- .../variableresolver/getters_postgres.go | 16 +- .../variableresolver/resolve.go | 9 +- .../variableresolver/resolve_test.go | 87 +++- .../test/controllers/harness/mocks.go | 10 +- packages/workspace-engine-sdk/src/schema.ts | 43 ++ 15 files changed, 1250 insertions(+), 53 deletions(-) create mode 100644 apps/api/openapi/paths/variablesets.jsonnet create mode 100644 apps/api/openapi/schemas/variablesets.jsonnet create mode 100644 apps/api/src/routes/v1/workspaces/variable-sets.ts diff --git a/apps/api/openapi/main.jsonnet b/apps/api/openapi/main.jsonnet index d9451de3a..d8ba69eef 100644 --- a/apps/api/openapi/main.jsonnet +++ b/apps/api/openapi/main.jsonnet @@ -49,7 +49,8 @@ local securitySchemes = { (import 'paths/release-targets.jsonnet') + (import 'paths/release.jsonnet') + (import 'paths/job-agents.jsonnet') + - (import 'paths/workflows.jsonnet'), + (import 'paths/workflows.jsonnet') + + (import 'paths/variablesets.jsonnet'), components: { parameters: {}, securitySchemes: securitySchemes, @@ -71,6 +72,7 @@ local securitySchemes = { (import 'schemas/release.jsonnet') + (import 'schemas/job-agents.jsonnet') + (import 'schemas/verifications.jsonnet') + - (import 'schemas/workflows.jsonnet'), + (import 'schemas/workflows.jsonnet') + + (import 'schemas/variablesets.jsonnet'), }, } diff --git a/apps/api/openapi/openapi.json b/apps/api/openapi/openapi.json index 84cf6d0ed..59f854d99 100644 --- a/apps/api/openapi/openapi.json +++ b/apps/api/openapi/openapi.json @@ -265,6 +265,35 @@ ], "type": "object" }, + "CreateVariableSet": { + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "priority": { + "type": "integer" + }, + "selector": { + "description": "A CEL expression to select which release targets this variable set applies to", + "type": "string" + }, + "variables": { + "items": { + "$ref": "#/components/schemas/VariableSetVariable" + }, + "type": "array" + } + }, + "required": [ + "name", + "selector", + "variables" + ], + "type": "object" + }, "CreateWorkflow": { "properties": { "inputs": { @@ -2410,6 +2439,29 @@ ], "type": "object" }, + "UpdateVariableSet": { + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "priority": { + "type": "integer" + }, + "selector": { + "type": "string" + }, + "variables": { + "items": { + "$ref": "#/components/schemas/VariableSetVariable" + }, + "type": "array" + } + }, + "type": "object" + }, "UpdateWorkflow": { "properties": { "inputs": { @@ -2898,6 +2950,81 @@ } ] }, + "VariableSet": { + "properties": { + "createdAt": { + "format": "date-time", + "type": "string" + }, + "description": { + "type": "string" + }, + "id": { + "format": "uuid", + "type": "string" + }, + "name": { + "type": "string" + }, + "priority": { + "type": "integer" + }, + "selector": { + "description": "A CEL expression to select which release targets this variable set applies to", + "type": "string" + }, + "updatedAt": { + "format": "date-time", + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "selector", + "priority", + "createdAt", + "updatedAt" + ], + "type": "object" + }, + "VariableSetVariable": { + "properties": { + "key": { + "type": "string" + }, + "value": { + "$ref": "#/components/schemas/Value" + } + }, + "required": [ + "key", + "value" + ], + "type": "object" + }, + "VariableSetWithVariables": { + "allOf": [ + { + "$ref": "#/components/schemas/VariableSet" + }, + { + "properties": { + "variables": { + "items": { + "$ref": "#/components/schemas/VariableSetVariable" + }, + "type": "array" + } + }, + "required": [ + "variables" + ], + "type": "object" + } + ] + }, "VerificationMeasurement": { "properties": { "data": { @@ -8531,6 +8658,341 @@ "summary": "Link environment to system" } }, + "/v1/workspaces/{workspaceId}/variable-sets": { + "get": { + "description": "Returns a list of variable sets.", + "operationId": "listVariableSets", + "parameters": [ + { + "description": "ID of the workspace", + "in": "path", + "name": "workspaceId", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Maximum number of items to return", + "in": "query", + "name": "limit", + "required": false, + "schema": { + "default": 50, + "maximum": 1000, + "minimum": 1, + "type": "integer" + } + }, + { + "description": "Number of items to skip", + "in": "query", + "name": "offset", + "required": false, + "schema": { + "default": 0, + "minimum": 0, + "type": "integer" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "items": { + "items": { + "$ref": "#/components/schemas/VariableSetWithVariables" + }, + "type": "array" + }, + "limit": { + "description": "Maximum number of items returned", + "type": "integer" + }, + "offset": { + "description": "Number of items skipped", + "type": "integer" + }, + "total": { + "description": "Total number of items available", + "type": "integer" + } + }, + "required": [ + "items", + "total", + "limit", + "offset" + ], + "type": "object" + } + } + }, + "description": "Paginated list of items" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Invalid request" + } + }, + "summary": "List variable sets", + "tags": [ + "Variable Sets" + ] + }, + "post": { + "description": "Creates a variable set.", + "operationId": "createVariableSet", + "parameters": [ + { + "description": "ID of the workspace", + "in": "path", + "name": "workspaceId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVariableSet" + } + } + }, + "required": true + }, + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VariableSet" + } + } + }, + "description": "Resource created successfully" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Invalid request" + } + }, + "summary": "Create a variable set", + "tags": [ + "Variable Sets" + ] + } + }, + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}": { + "delete": { + "description": "Deletes a variable set.", + "operationId": "deleteVariableSet", + "parameters": [ + { + "description": "ID of the workspace", + "in": "path", + "name": "workspaceId", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "ID of the variable set", + "in": "path", + "name": "variableSetId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VariableSet" + } + } + }, + "description": "Variable set deleted" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Invalid request" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Resource not found" + } + }, + "summary": "Delete a variable set", + "tags": [ + "Variable Sets" + ] + }, + "get": { + "description": "Gets a variable set by ID.", + "operationId": "getVariableSet", + "parameters": [ + { + "description": "ID of the workspace", + "in": "path", + "name": "workspaceId", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "ID of the variable set", + "in": "path", + "name": "variableSetId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VariableSetWithVariables" + } + } + }, + "description": "OK response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Invalid request" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Resource not found" + } + }, + "summary": "Get a variable set", + "tags": [ + "Variable Sets" + ] + }, + "put": { + "description": "Updates a variable set.", + "operationId": "updateVariableSet", + "parameters": [ + { + "description": "ID of the workspace", + "in": "path", + "name": "workspaceId", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "ID of the variable set", + "in": "path", + "name": "variableSetId", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateVariableSet" + } + } + }, + "required": true + }, + "responses": { + "202": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VariableSet" + } + } + }, + "description": "Accepted response" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Invalid request" + }, + "404": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + }, + "description": "Resource not found" + } + }, + "summary": "Update a variable set", + "tags": [ + "Variable Sets" + ] + } + }, "/v1/workspaces/{workspaceId}/workflows": { "get": { "description": "Returns a list of workflows.", diff --git a/apps/api/openapi/paths/variablesets.jsonnet b/apps/api/openapi/paths/variablesets.jsonnet new file mode 100644 index 000000000..f3c0e88d2 --- /dev/null +++ b/apps/api/openapi/paths/variablesets.jsonnet @@ -0,0 +1,87 @@ +local openapi = import '../lib/openapi.libsonnet'; + +{ + '/v1/workspaces/{workspaceId}/variable-sets': { + get: { + tags: ['Variable Sets'], + summary: 'List variable sets', + operationId: 'listVariableSets', + description: 'Returns a list of variable sets.', + parameters: [ + openapi.workspaceIdParam(), + openapi.limitParam(), + openapi.offsetParam(), + ], + responses: openapi.paginatedResponse(openapi.schemaRef('VariableSetWithVariables')) + + openapi.badRequestResponse(), + }, + post: { + tags: ['Variable Sets'], + summary: 'Create a variable set', + operationId: 'createVariableSet', + description: 'Creates a variable set.', + parameters: [ + openapi.workspaceIdParam(), + ], + requestBody: { + required: true, + content: { + 'application/json': { + schema: openapi.schemaRef('CreateVariableSet'), + }, + }, + }, + responses: openapi.createdResponse(openapi.schemaRef('VariableSet')) + + openapi.badRequestResponse(), + }, + }, + '/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}': { + get: { + tags: ['Variable Sets'], + summary: 'Get a variable set', + operationId: 'getVariableSet', + description: 'Gets a variable set by ID.', + parameters: [ + openapi.workspaceIdParam(), + openapi.stringParam('variableSetId', 'ID of the variable set'), + ], + responses: openapi.okResponse(openapi.schemaRef('VariableSetWithVariables')) + + openapi.notFoundResponse() + + openapi.badRequestResponse(), + }, + put: { + tags: ['Variable Sets'], + summary: 'Update a variable set', + operationId: 'updateVariableSet', + description: 'Updates a variable set.', + parameters: [ + openapi.workspaceIdParam(), + openapi.stringParam('variableSetId', 'ID of the variable set'), + ], + requestBody: { + required: true, + content: { + 'application/json': { + schema: openapi.schemaRef('UpdateVariableSet'), + }, + }, + }, + responses: openapi.acceptedResponse(openapi.schemaRef('VariableSet')) + + openapi.notFoundResponse() + + openapi.badRequestResponse(), + }, + delete: { + tags: ['Variable Sets'], + summary: 'Delete a variable set', + operationId: 'deleteVariableSet', + description: 'Deletes a variable set.', + parameters: [ + openapi.workspaceIdParam(), + openapi.stringParam('variableSetId', 'ID of the variable set'), + ], + responses: openapi.acceptedResponse(openapi.schemaRef('VariableSet'), 'Variable set deleted') + + openapi.notFoundResponse() + + openapi.badRequestResponse(), + }, + }, +} diff --git a/apps/api/openapi/schemas/variablesets.jsonnet b/apps/api/openapi/schemas/variablesets.jsonnet new file mode 100644 index 000000000..c45a15695 --- /dev/null +++ b/apps/api/openapi/schemas/variablesets.jsonnet @@ -0,0 +1,62 @@ +local openapi = import '../lib/openapi.libsonnet'; + +{ + VariableSet: { + type: 'object', + required: ['id', 'name', 'description', 'selector', 'priority', 'createdAt', 'updatedAt'], + properties: { + id: { type: 'string', format: 'uuid' }, + name: { type: 'string' }, + description: { type: 'string' }, + selector: { type: 'string', description: 'A CEL expression to select which release targets this variable set applies to' }, + priority: { type: 'integer' }, + createdAt: { type: 'string', format: 'date-time' }, + updatedAt: { type: 'string', format: 'date-time' }, + }, + }, + + VariableSetVariable: { + type: 'object', + required: ['key', 'value'], + properties: { + key: { type: 'string' }, + value: openapi.schemaRef('Value'), + }, + }, + + VariableSetWithVariables: { + allOf: [ + openapi.schemaRef('VariableSet'), + { + type: 'object', + required: ['variables'], + properties: { + variables: { type: 'array', items: openapi.schemaRef('VariableSetVariable') }, + }, + }, + ], + }, + + CreateVariableSet: { + type: 'object', + required: ['name', 'selector', 'variables'], + properties: { + name: { type: 'string' }, + description: { type: 'string' }, + selector: { type: 'string', description: 'A CEL expression to select which release targets this variable set applies to' }, + priority: { type: 'integer' }, + variables: { type: 'array', items: openapi.schemaRef('VariableSetVariable') }, + }, + }, + + UpdateVariableSet: { + type: 'object', + properties: { + name: { type: 'string' }, + description: { type: 'string' }, + selector: { type: 'string' }, + priority: { type: 'integer' }, + variables: { type: 'array', items: openapi.schemaRef('VariableSetVariable') }, + }, + }, +} diff --git a/apps/api/src/routes/v1/workspaces/index.ts b/apps/api/src/routes/v1/workspaces/index.ts index e08917736..440d6889a 100644 --- a/apps/api/src/routes/v1/workspaces/index.ts +++ b/apps/api/src/routes/v1/workspaces/index.ts @@ -25,6 +25,7 @@ import { releaseRouter } from "./releases.js"; import { resourceProvidersRouter } from "./resource-providers.js"; import { resourceRouter } from "./resources.js"; import { systemRouter } from "./systems.js"; +import { variableSetsRouter } from "./variable-sets.js"; import { workflowsRouter } from "./workflows.js"; /** @@ -55,4 +56,5 @@ export const createWorkspacesRouter = (): Router => .use("/:workspaceId/release-targets", releaseTargetsRouter) .use("/:workspaceId/releases", releaseRouter) .use("/:workspaceId/job-agents", jobAgentsRouter) - .use("/:workspaceId/workflows", workflowsRouter); + .use("/:workspaceId/workflows", workflowsRouter) + .use("/:workspaceId/variable-sets", variableSetsRouter); diff --git a/apps/api/src/routes/v1/workspaces/variable-sets.ts b/apps/api/src/routes/v1/workspaces/variable-sets.ts new file mode 100644 index 000000000..b28e0e3f0 --- /dev/null +++ b/apps/api/src/routes/v1/workspaces/variable-sets.ts @@ -0,0 +1,180 @@ +import type { AsyncTypedHandler } from "@/types/api.js"; +import { asyncHandler, NotFoundError } from "@/types/api.js"; +import { Router } from "express"; + +import { + and, + count, + eq, + inArray, + takeFirst, + takeFirstOrNull, +} from "@ctrlplane/db"; +import { db } from "@ctrlplane/db/client"; +import * as schema from "@ctrlplane/db/schema"; + +const listVariableSets: AsyncTypedHandler< + "/v1/workspaces/{workspaceId}/variable-sets", + "get" +> = async (req, res) => { + const { workspaceId } = req.params; + const limit = req.query.limit ?? 50; + const offset = req.query.offset ?? 0; + + const total = await db + .select({ total: count() }) + .from(schema.variableSet) + .where(eq(schema.variableSet.workspaceId, workspaceId)) + .then(takeFirst) + .then(({ total }) => total); + + const sets = await db + .select() + .from(schema.variableSet) + .where(eq(schema.variableSet.workspaceId, workspaceId)) + .limit(limit) + .offset(offset); + + const setIds = sets.map((s) => s.id); + const allVariables = + setIds.length > 0 + ? await db + .select() + .from(schema.variableSetVariable) + .where(inArray(schema.variableSetVariable.variableSetId, setIds)) + : []; + + const items = sets.map((s) => ({ + ...s, + variables: allVariables.filter((v) => v.variableSetId === s.id), + })); + + res.status(200).json({ items, total, limit, offset }); +}; + +const createVariableSet: AsyncTypedHandler< + "/v1/workspaces/{workspaceId}/variable-sets", + "post" +> = async (req, res) => { + const { workspaceId } = req.params; + const { variables, ...setData } = req.body; + + const created = await db.transaction(async (tx) => { + const vs = await tx + .insert(schema.variableSet) + .values({ ...setData, workspaceId }) + .returning() + .then(takeFirst); + + if (variables.length > 0) + await tx.insert(schema.variableSetVariable).values( + variables.map((v) => ({ + variableSetId: vs.id, + key: v.key, + value: v.value, + })), + ); + + return vs; + }); + + res.status(201).json(created); +}; + +const getVariableSet: AsyncTypedHandler< + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}", + "get" +> = async (req, res) => { + const { variableSetId, workspaceId } = req.params; + const vs = await db + .select() + .from(schema.variableSet) + .where( + and( + eq(schema.variableSet.id, variableSetId), + eq(schema.variableSet.workspaceId, workspaceId), + ), + ) + .then(takeFirstOrNull); + + if (vs == null) throw new NotFoundError("Variable set not found"); + + const variables = await db + .select() + .from(schema.variableSetVariable) + .where(eq(schema.variableSetVariable.variableSetId, variableSetId)); + + res.json({ ...vs, variables }); +}; + +const updateVariableSet: AsyncTypedHandler< + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}", + "put" +> = async (req, res) => { + const { variableSetId, workspaceId } = req.params; + const { variables, ...setData } = req.body; + + const updated = await db.transaction(async (tx) => { + const vs = await tx + .update(schema.variableSet) + .set(setData) + .where( + and( + eq(schema.variableSet.id, variableSetId), + eq(schema.variableSet.workspaceId, workspaceId), + ), + ) + .returning() + .then(takeFirstOrNull); + + if (vs == null) return null; + + if (variables != null) { + await tx + .delete(schema.variableSetVariable) + .where(eq(schema.variableSetVariable.variableSetId, variableSetId)); + + if (variables.length > 0) { + await tx.insert(schema.variableSetVariable).values( + variables.map((v) => ({ + variableSetId: vs.id, + key: v.key, + value: v.value, + })), + ); + } + } + + return vs; + }); + + if (updated == null) throw new NotFoundError("Variable set not found"); + res.status(202).json(updated); +}; + +const deleteVariableSet: AsyncTypedHandler< + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}", + "delete" +> = async (req, res) => { + const { variableSetId, workspaceId } = req.params; + const deleted = await db + .delete(schema.variableSet) + .where( + and( + eq(schema.variableSet.id, variableSetId), + eq(schema.variableSet.workspaceId, workspaceId), + ), + ) + .returning() + .then(takeFirstOrNull); + + if (deleted == null) throw new NotFoundError("Variable set not found"); + res.status(202).json(deleted); +}; + +export const variableSetsRouter = Router({ mergeParams: true }) + .get("/", asyncHandler(listVariableSets)) + .post("/", asyncHandler(createVariableSet)) + .get("/:variableSetId", asyncHandler(getVariableSet)) + .put("/:variableSetId", asyncHandler(updateVariableSet)) + .delete("/:variableSetId", asyncHandler(deleteVariableSet)); diff --git a/apps/api/src/types/openapi.ts b/apps/api/src/types/openapi.ts index 4551aa015..ddf0cc2a0 100644 --- a/apps/api/src/types/openapi.ts +++ b/apps/api/src/types/openapi.ts @@ -896,6 +896,58 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/workspaces/{workspaceId}/variable-sets": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List variable sets + * @description Returns a list of variable sets. + */ + get: operations["listVariableSets"]; + put?: never; + /** + * Create a variable set + * @description Creates a variable set. + */ + post: operations["createVariableSet"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get a variable set + * @description Gets a variable set by ID. + */ + get: operations["getVariableSet"]; + /** + * Update a variable set + * @description Updates a variable set. + */ + put: operations["updateVariableSet"]; + post?: never; + /** + * Delete a variable set + * @description Deletes a variable set. + */ + delete: operations["deleteVariableSet"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/workspaces/{workspaceId}/workflows": { parameters: { query?: never; @@ -1067,6 +1119,14 @@ export interface components { name: string; slug?: string; }; + CreateVariableSet: { + description?: string; + name: string; + priority?: number; + /** @description A CEL expression to select which release targets this variable set applies to */ + selector: string; + variables: components["schemas"]["VariableSetVariable"][]; + }; CreateWorkflow: { inputs: components["schemas"]["WorkflowInput"][]; jobAgents: components["schemas"]["CreateWorkflowJobAgent"][]; @@ -1829,6 +1889,13 @@ export interface components { status?: components["schemas"]["DeploymentVersionStatus"]; tag?: string; }; + UpdateVariableSet: { + description?: string; + name?: string; + priority?: number; + selector?: string; + variables?: components["schemas"]["VariableSetVariable"][]; + }; UpdateWorkflow: { inputs: components["schemas"]["WorkflowInput"][]; jobAgents: components["schemas"]["CreateWorkflowJobAgent"][]; @@ -1990,6 +2057,26 @@ export interface components { message: string; }; Value: components["schemas"]["LiteralValue"] | components["schemas"]["ReferenceValue"] | components["schemas"]["SensitiveValue"]; + VariableSet: { + /** Format: date-time */ + createdAt: string; + description: string; + /** Format: uuid */ + id: string; + name: string; + priority: number; + /** @description A CEL expression to select which release targets this variable set applies to */ + selector: string; + /** Format: date-time */ + updatedAt: string; + }; + VariableSetVariable: { + key: string; + value: components["schemas"]["Value"]; + }; + VariableSetWithVariables: components["schemas"]["VariableSet"] & { + variables: components["schemas"]["VariableSetVariable"][]; + }; VerificationMeasurement: { /** @description Raw measurement data */ data?: { @@ -5534,6 +5621,220 @@ export interface operations { }; }; }; + listVariableSets: { + parameters: { + query?: { + /** @description Maximum number of items to return */ + limit?: number; + /** @description Number of items to skip */ + offset?: number; + }; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Paginated list of items */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + items: components["schemas"]["VariableSetWithVariables"][]; + /** @description Maximum number of items returned */ + limit: number; + /** @description Number of items skipped */ + offset: number; + /** @description Total number of items available */ + total: number; + }; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + createVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateVariableSet"]; + }; + }; + responses: { + /** @description Resource created successfully */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + getVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSetWithVariables"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + updateVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UpdateVariableSet"]; + }; + }; + responses: { + /** @description Accepted response */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + deleteVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Variable set deleted */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; listWorkflows: { parameters: { query?: { diff --git a/apps/workspace-engine/pkg/db/convert.go b/apps/workspace-engine/pkg/db/convert.go index 75bf6822b..6a5aaefc9 100644 --- a/apps/workspace-engine/pkg/db/convert.go +++ b/apps/workspace-engine/pkg/db/convert.go @@ -323,7 +323,9 @@ func ToOapiDeploymentVariableValue(row DeploymentVariableValue) oapi.DeploymentV return v } -func ToOapiVariableSetWithVariables(row ListVariableSetsWithVariablesByWorkspaceIDRow) oapi.VariableSetWithVariables { +func ToOapiVariableSetWithVariables( + row ListVariableSetsWithVariablesByWorkspaceIDRow, +) oapi.VariableSetWithVariables { vs := oapi.VariableSetWithVariables{ Id: row.ID, Name: row.Name, @@ -346,9 +348,17 @@ func ToOapiVariableSetWithVariables(row ListVariableSetsWithVariablesByWorkspace for _, v := range varsRaw { var val oapi.Value _ = val.UnmarshalJSON(v.Value) + id, err := uuid.Parse(v.Id) + if err != nil { + continue + } + variableSetId, err := uuid.Parse(v.VariableSetId) + if err != nil { + continue + } vs.Variables = append(vs.Variables, oapi.VariableSetVariable{ - Id: uuid.MustParse(v.Id), - VariableSetId: uuid.MustParse(v.VariableSetId), + Id: id, + VariableSetId: variableSetId, Key: v.Key, Value: val, }) diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go b/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go index 753516e44..0a9e120f1 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/reconcile_test.go @@ -4,14 +4,13 @@ import ( "context" "testing" + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" "workspace-engine/pkg/workspace/releasemanager/policy/evaluator" "workspace-engine/pkg/workspace/releasemanager/policy/evaluator/environmentprogression" - - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) // --------------------------------------------------------------------------- @@ -222,7 +221,10 @@ func (m *mockReconcileGetter) GetJobsForEnvironmentAndVersion( return nil, nil } -func (m *mockReconcileGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { +func (m *mockReconcileGetter) GetVariableSetsWithVariables( + ctx context.Context, + workspaceID uuid.UUID, +) ([]oapi.VariableSetWithVariables, error) { return nil, nil } diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go index cc30473a4..7df1e2408 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters.go @@ -3,10 +3,9 @@ package variableresolver import ( "context" + "github.com/google/uuid" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" - - "github.com/google/uuid" ) // Getter provides the data needed to resolve deployment variables for a @@ -21,7 +20,10 @@ type Getter interface { ctx context.Context, resourceID string, ) (map[string]oapi.ResourceVariable, error) - GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) + GetVariableSetsWithVariables( + ctx context.Context, + workspaceID uuid.UUID, + ) ([]oapi.VariableSetWithVariables, error) GetRelationshipRules(ctx context.Context, workspaceID uuid.UUID) ([]eval.Rule, error) LoadCandidates( ctx context.Context, diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go index d3eae0496..46a4826a1 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/getters_postgres.go @@ -4,12 +4,11 @@ import ( "context" "fmt" + "github.com/google/uuid" + "github.com/jackc/pgx/v5/pgtype" "workspace-engine/pkg/db" "workspace-engine/pkg/oapi" "workspace-engine/pkg/workspace/relationships/eval" - - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" ) var _ Getter = (*PostgresGetter)(nil) @@ -161,10 +160,17 @@ func (g *PostgresGetter) GetResourceVariables( return result, nil } -func (g *PostgresGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { +func (g *PostgresGetter) GetVariableSetsWithVariables( + ctx context.Context, + workspaceID uuid.UUID, +) ([]oapi.VariableSetWithVariables, error) { rows, err := db.GetQueries(ctx).ListVariableSetsWithVariablesByWorkspaceID(ctx, workspaceID) if err != nil { - return nil, fmt.Errorf("list variable sets with variables for workspace %s: %w", workspaceID, err) + return nil, fmt.Errorf( + "list variable sets with variables for workspace %s: %w", + workspaceID, + err, + ) } result := make([]oapi.VariableSetWithVariables, 0, len(rows)) for _, row := range rows { diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go index 3f11a3620..ff7d94e19 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go @@ -5,16 +5,15 @@ import ( "fmt" "sort" + "github.com/google/uuid" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" "workspace-engine/pkg/celutil" "workspace-engine/pkg/oapi" "workspace-engine/pkg/selector" cel "workspace-engine/pkg/selector/langs/cel" "workspace-engine/pkg/workspace/relationships/eval" - - "github.com/google/uuid" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" ) func NewResourceEntity(resource *oapi.Resource) *oapi.RelatableEntity { diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go index 3e93bde6c..0e546bfab 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" - "workspace-engine/pkg/oapi" - "workspace-engine/pkg/workspace/relationships/eval" - "github.com/google/uuid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "workspace-engine/pkg/oapi" + "workspace-engine/pkg/workspace/relationships/eval" ) // --------------------------------------------------------------------------- @@ -54,7 +53,10 @@ func (m *mockGetter) GetResourceVariables( return m.resourceVars, nil } -func (m *mockGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { +func (m *mockGetter) GetVariableSetsWithVariables( + ctx context.Context, + workspaceID uuid.UUID, +) ([]oapi.VariableSetWithVariables, error) { return m.variableSets, nil } @@ -1019,9 +1021,14 @@ func TestResolve_VariableSet_SimpleInjection(t *testing.T) { }}, resourceVars: map[string]oapi.ResourceVariable{}, variableSets: []oapi.VariableSetWithVariables{ - makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ - "log_level": "warn", - }), + makeVariableSet( + "prod-defaults", + `resource.metadata.env == "production"`, + 1, + map[string]string{ + "log_level": "warn", + }, + ), }, } @@ -1064,9 +1071,14 @@ func TestResolve_VariableSet_DoesNotOverwriteResourceVar(t *testing.T) { }, }, variableSets: []oapi.VariableSetWithVariables{ - makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ - "log_level": "warn", - }), + makeVariableSet( + "prod-defaults", + `resource.metadata.env == "production"`, + 1, + map[string]string{ + "log_level": "warn", + }, + ), }, } @@ -1109,9 +1121,14 @@ func TestResolve_VariableSet_DoesNotOverwriteDeploymentVarValue(t *testing.T) { }}, resourceVars: map[string]oapi.ResourceVariable{}, variableSets: []oapi.VariableSetWithVariables{ - makeVariableSet("prod-defaults", `resource.metadata.env == "production"`, 1, map[string]string{ - "log_level": "warn", - }), + makeVariableSet( + "prod-defaults", + `resource.metadata.env == "production"`, + 1, + map[string]string{ + "log_level": "warn", + }, + ), }, } @@ -1148,15 +1165,30 @@ func TestResolve_VariableSet_HighestPriorityWins(t *testing.T) { }}, resourceVars: map[string]oapi.ResourceVariable{}, variableSets: []oapi.VariableSetWithVariables{ - makeVariableSet("low-priority", `resource.metadata.env == "production"`, 1, map[string]string{ - "log_level": "trace", - }), - makeVariableSet("high-priority", `resource.metadata.env == "production"`, 100, map[string]string{ - "log_level": "error", - }), - makeVariableSet("medium-priority", `resource.metadata.env == "production"`, 50, map[string]string{ - "log_level": "info", - }), + makeVariableSet( + "low-priority", + `resource.metadata.env == "production"`, + 1, + map[string]string{ + "log_level": "trace", + }, + ), + makeVariableSet( + "high-priority", + `resource.metadata.env == "production"`, + 100, + map[string]string{ + "log_level": "error", + }, + ), + makeVariableSet( + "medium-priority", + `resource.metadata.env == "production"`, + 50, + map[string]string{ + "log_level": "info", + }, + ), }, } @@ -1193,9 +1225,14 @@ func TestResolve_VariableSet_UnrelatedDoNotMatch(t *testing.T) { }}, resourceVars: map[string]oapi.ResourceVariable{}, variableSets: []oapi.VariableSetWithVariables{ - makeVariableSet("prod-only", `resource.metadata.env == "production"`, 1, map[string]string{ - "log_level": "warn", - }), + makeVariableSet( + "prod-only", + `resource.metadata.env == "production"`, + 1, + map[string]string{ + "log_level": "warn", + }, + ), }, } diff --git a/apps/workspace-engine/test/controllers/harness/mocks.go b/apps/workspace-engine/test/controllers/harness/mocks.go index bda79921c..ad67aaf25 100644 --- a/apps/workspace-engine/test/controllers/harness/mocks.go +++ b/apps/workspace-engine/test/controllers/harness/mocks.go @@ -7,6 +7,7 @@ import ( "sync" "time" + "github.com/google/uuid" "workspace-engine/pkg/celutil" "workspace-engine/pkg/oapi" "workspace-engine/pkg/policies/match" @@ -21,8 +22,6 @@ import ( "workspace-engine/svc/controllers/jobdispatch" "workspace-engine/svc/controllers/jobverificationmetric/metrics" "workspace-engine/svc/controllers/jobverificationmetric/metrics/provider" - - "github.com/google/uuid" ) var celEnv, _ = celutil.NewEnvBuilder(). @@ -464,8 +463,11 @@ func (g *DesiredReleaseGetter) GetJobsForEnvironmentAndVersion( return result, nil } -func (g *DesiredReleaseGetter) GetVariableSetsWithVariables(ctx context.Context, workspaceID uuid.UUID) ([]oapi.VariableSetWithVariables, error) { - return nil, nil +func (g *DesiredReleaseGetter) GetVariableSetsWithVariables( + ctx context.Context, + workspaceID uuid.UUID, +) ([]oapi.VariableSetWithVariables, error) { + return g.VariableSets, nil } type eligibilityCall struct { diff --git a/packages/workspace-engine-sdk/src/schema.ts b/packages/workspace-engine-sdk/src/schema.ts index da3abf67f..fa7b8430c 100644 --- a/packages/workspace-engine-sdk/src/schema.ts +++ b/packages/workspace-engine-sdk/src/schema.ts @@ -1132,6 +1132,49 @@ export interface components { | components["schemas"]["LiteralValue"] | components["schemas"]["ReferenceValue"] | components["schemas"]["SensitiveValue"]; + VariableSet: { + /** + * Format: date-time + * @description The timestamp when the variable set was created + */ + createdAt: string; + /** @description The description of the variable set */ + description: string; + /** Format: uuid */ + id: string; + /** @description The name of the variable set */ + name: string; + /** + * Format: int64 + * @description The priority of the variable set + */ + priority: number; + /** @description A CEL expression to select which resources this value applies to */ + selector: string; + /** + * Format: date-time + * @description The timestamp when the variable set was last updated + */ + updatedAt: string; + }; + VariableSetVariable: { + /** + * Format: uuid + * @description The ID of the variable + */ + id: string; + /** @description The key of the variable, unique within the variable set */ + key: string; + value: components["schemas"]["Value"]; + /** + * Format: uuid + * @description The ID of the variable set this variable belongs to + */ + variableSetId: string; + }; + VariableSetWithVariables: components["schemas"]["VariableSet"] & { + variables: components["schemas"]["VariableSetVariable"][]; + }; VerificationMeasurement: { /** @description Raw measurement data */ data: { From 9b0a894c41768b38e44957cc502485ff26db3e1a Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Wed, 1 Apr 2026 15:02:43 -0700 Subject: [PATCH 07/10] cleanup --- apps/api/openapi/openapi.json | 2 + apps/api/openapi/schemas/variablesets.jsonnet | 4 +- .../src/routes/v1/workspaces/variable-sets.ts | 4 +- apps/api/src/types/openapi.ts | 6 +- apps/web/app/api/openapi.ts | 307 +++++++++++++++++- .../pkg/db/queries/variable_sets.sql | 2 +- .../pkg/db/variable_sets.sql.go | 2 +- .../variableresolver/resolve.go | 9 +- 8 files changed, 325 insertions(+), 11 deletions(-) diff --git a/apps/api/openapi/openapi.json b/apps/api/openapi/openapi.json index 59f854d99..a93f2292e 100644 --- a/apps/api/openapi/openapi.json +++ b/apps/api/openapi/openapi.json @@ -268,12 +268,14 @@ "CreateVariableSet": { "properties": { "description": { + "default": "", "type": "string" }, "name": { "type": "string" }, "priority": { + "default": 0, "type": "integer" }, "selector": { diff --git a/apps/api/openapi/schemas/variablesets.jsonnet b/apps/api/openapi/schemas/variablesets.jsonnet index c45a15695..1ae42f63d 100644 --- a/apps/api/openapi/schemas/variablesets.jsonnet +++ b/apps/api/openapi/schemas/variablesets.jsonnet @@ -42,9 +42,9 @@ local openapi = import '../lib/openapi.libsonnet'; required: ['name', 'selector', 'variables'], properties: { name: { type: 'string' }, - description: { type: 'string' }, + description: { type: 'string', default: '' }, selector: { type: 'string', description: 'A CEL expression to select which release targets this variable set applies to' }, - priority: { type: 'integer' }, + priority: { type: 'integer', default: 0 }, variables: { type: 'array', items: openapi.schemaRef('VariableSetVariable') }, }, }, diff --git a/apps/api/src/routes/v1/workspaces/variable-sets.ts b/apps/api/src/routes/v1/workspaces/variable-sets.ts index b28e0e3f0..96692c8ad 100644 --- a/apps/api/src/routes/v1/workspaces/variable-sets.ts +++ b/apps/api/src/routes/v1/workspaces/variable-sets.ts @@ -5,6 +5,7 @@ import { Router } from "express"; import { and, count, + desc, eq, inArray, takeFirst, @@ -32,6 +33,7 @@ const listVariableSets: AsyncTypedHandler< .select() .from(schema.variableSet) .where(eq(schema.variableSet.workspaceId, workspaceId)) + .orderBy(desc(schema.variableSet.priority), schema.variableSet.name) .limit(limit) .offset(offset); @@ -57,7 +59,7 @@ const createVariableSet: AsyncTypedHandler< "post" > = async (req, res) => { const { workspaceId } = req.params; - const { variables, ...setData } = req.body; + const { variables = [], ...setData } = req.body; const created = await db.transaction(async (tx) => { const vs = await tx diff --git a/apps/api/src/types/openapi.ts b/apps/api/src/types/openapi.ts index ddf0cc2a0..b6c082868 100644 --- a/apps/api/src/types/openapi.ts +++ b/apps/api/src/types/openapi.ts @@ -1120,9 +1120,11 @@ export interface components { slug?: string; }; CreateVariableSet: { - description?: string; + /** @default */ + description: string; name: string; - priority?: number; + /** @default 0 */ + priority: number; /** @description A CEL expression to select which release targets this variable set applies to */ selector: string; variables: components["schemas"]["VariableSetVariable"][]; diff --git a/apps/web/app/api/openapi.ts b/apps/web/app/api/openapi.ts index f737765ac..b6c082868 100644 --- a/apps/web/app/api/openapi.ts +++ b/apps/web/app/api/openapi.ts @@ -896,6 +896,58 @@ export interface paths { patch?: never; trace?: never; }; + "/v1/workspaces/{workspaceId}/variable-sets": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List variable sets + * @description Returns a list of variable sets. + */ + get: operations["listVariableSets"]; + put?: never; + /** + * Create a variable set + * @description Creates a variable set. + */ + post: operations["createVariableSet"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/v1/workspaces/{workspaceId}/variable-sets/{variableSetId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Get a variable set + * @description Gets a variable set by ID. + */ + get: operations["getVariableSet"]; + /** + * Update a variable set + * @description Updates a variable set. + */ + put: operations["updateVariableSet"]; + post?: never; + /** + * Delete a variable set + * @description Deletes a variable set. + */ + delete: operations["deleteVariableSet"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/v1/workspaces/{workspaceId}/workflows": { parameters: { query?: never; @@ -1067,6 +1119,16 @@ export interface components { name: string; slug?: string; }; + CreateVariableSet: { + /** @default */ + description: string; + name: string; + /** @default 0 */ + priority: number; + /** @description A CEL expression to select which release targets this variable set applies to */ + selector: string; + variables: components["schemas"]["VariableSetVariable"][]; + }; CreateWorkflow: { inputs: components["schemas"]["WorkflowInput"][]; jobAgents: components["schemas"]["CreateWorkflowJobAgent"][]; @@ -1829,6 +1891,13 @@ export interface components { status?: components["schemas"]["DeploymentVersionStatus"]; tag?: string; }; + UpdateVariableSet: { + description?: string; + name?: string; + priority?: number; + selector?: string; + variables?: components["schemas"]["VariableSetVariable"][]; + }; UpdateWorkflow: { inputs: components["schemas"]["WorkflowInput"][]; jobAgents: components["schemas"]["CreateWorkflowJobAgent"][]; @@ -1990,6 +2059,26 @@ export interface components { message: string; }; Value: components["schemas"]["LiteralValue"] | components["schemas"]["ReferenceValue"] | components["schemas"]["SensitiveValue"]; + VariableSet: { + /** Format: date-time */ + createdAt: string; + description: string; + /** Format: uuid */ + id: string; + name: string; + priority: number; + /** @description A CEL expression to select which release targets this variable set applies to */ + selector: string; + /** Format: date-time */ + updatedAt: string; + }; + VariableSetVariable: { + key: string; + value: components["schemas"]["Value"]; + }; + VariableSetWithVariables: components["schemas"]["VariableSet"] & { + variables: components["schemas"]["VariableSetVariable"][]; + }; VerificationMeasurement: { /** @description Raw measurement data */ data?: { @@ -5534,6 +5623,220 @@ export interface operations { }; }; }; + listVariableSets: { + parameters: { + query?: { + /** @description Maximum number of items to return */ + limit?: number; + /** @description Number of items to skip */ + offset?: number; + }; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Paginated list of items */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + items: components["schemas"]["VariableSetWithVariables"][]; + /** @description Maximum number of items returned */ + limit: number; + /** @description Number of items skipped */ + offset: number; + /** @description Total number of items available */ + total: number; + }; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + createVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateVariableSet"]; + }; + }; + responses: { + /** @description Resource created successfully */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + getVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSetWithVariables"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + updateVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UpdateVariableSet"]; + }; + }; + responses: { + /** @description Accepted response */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + deleteVariableSet: { + parameters: { + query?: never; + header?: never; + path: { + /** @description ID of the workspace */ + workspaceId: string; + /** @description ID of the variable set */ + variableSetId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Variable set deleted */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["VariableSet"]; + }; + }; + /** @description Invalid request */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description Resource not found */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; listWorkflows: { parameters: { query?: { @@ -5595,8 +5898,8 @@ export interface operations { }; }; responses: { - /** @description Accepted response */ - 202: { + /** @description Resource created successfully */ + 201: { headers: { [name: string]: unknown; }; diff --git a/apps/workspace-engine/pkg/db/queries/variable_sets.sql b/apps/workspace-engine/pkg/db/queries/variable_sets.sql index 8c1b60c42..1a3d514bb 100644 --- a/apps/workspace-engine/pkg/db/queries/variable_sets.sql +++ b/apps/workspace-engine/pkg/db/queries/variable_sets.sql @@ -8,4 +8,4 @@ SELECT ) AS variables FROM variable_set vs WHERE vs.workspace_id = $1 -ORDER BY vs.priority DESC; +ORDER BY vs.priority DESC, vs.name ASC; diff --git a/apps/workspace-engine/pkg/db/variable_sets.sql.go b/apps/workspace-engine/pkg/db/variable_sets.sql.go index 599f2b5a9..de2eaf6ea 100644 --- a/apps/workspace-engine/pkg/db/variable_sets.sql.go +++ b/apps/workspace-engine/pkg/db/variable_sets.sql.go @@ -22,7 +22,7 @@ SELECT ) AS variables FROM variable_set vs WHERE vs.workspace_id = $1 -ORDER BY vs.priority DESC +ORDER BY vs.priority DESC, vs.name ASC ` type ListVariableSetsWithVariablesByWorkspaceIDRow struct { diff --git a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go index ff7d94e19..69483ccc4 100644 --- a/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go +++ b/apps/workspace-engine/svc/controllers/desiredrelease/variableresolver/resolve.go @@ -39,7 +39,9 @@ type Scope struct { // 1. Resource variable with matching key (highest priority) // 2. Deployment variable value whose resource selector matches, sorted by // descending priority -// 3. Deployment variable default value +// 3. Variable set value from sets matching the release target (filtered by +// filterVariableSets, sorted by descending priority with name tiebreak) +// 4. Deployment variable default value func Resolve( ctx context.Context, getter Getter, @@ -344,7 +346,10 @@ func filterVariableSets( } } sort.Slice(matched, func(i, j int) bool { - return matched[i].Priority > matched[j].Priority + if matched[i].Priority != matched[j].Priority { + return matched[i].Priority > matched[j].Priority + } + return matched[i].Name < matched[j].Name }) return matched } From e0ed1bae9c658eea77cd8d647373a70d5d292b0a Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Mon, 6 Apr 2026 10:56:42 -0700 Subject: [PATCH 08/10] drop --- .../db/drizzle/0182_silent_blazing_skull.sql | 22 - packages/db/drizzle/meta/0182_snapshot.json | 6429 ----------------- packages/db/drizzle/meta/_journal.json | 7 - 3 files changed, 6458 deletions(-) delete mode 100644 packages/db/drizzle/0182_silent_blazing_skull.sql delete mode 100644 packages/db/drizzle/meta/0182_snapshot.json diff --git a/packages/db/drizzle/0182_silent_blazing_skull.sql b/packages/db/drizzle/0182_silent_blazing_skull.sql deleted file mode 100644 index c35dddd63..000000000 --- a/packages/db/drizzle/0182_silent_blazing_skull.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "variable_set" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "name" text NOT NULL, - "description" text DEFAULT '' NOT NULL, - "selector" text NOT NULL, - "metadata" jsonb DEFAULT '{}' NOT NULL, - "priority" integer DEFAULT 0 NOT NULL, - "workspace_id" uuid NOT NULL, - "created_at" timestamp with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp with time zone DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "variable_set_variable" ( - "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, - "variable_set_id" uuid NOT NULL, - "key" text NOT NULL, - "value" jsonb NOT NULL, - CONSTRAINT "variable_set_variable_variable_set_id_key_unique" UNIQUE("variable_set_id","key") -); ---> statement-breakpoint -ALTER TABLE "variable_set" ADD CONSTRAINT "variable_set_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "variable_set_variable" ADD CONSTRAINT "variable_set_variable_variable_set_id_variable_set_id_fk" FOREIGN KEY ("variable_set_id") REFERENCES "public"."variable_set"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0182_snapshot.json b/packages/db/drizzle/meta/0182_snapshot.json deleted file mode 100644 index f3d8c1307..000000000 --- a/packages/db/drizzle/meta/0182_snapshot.json +++ /dev/null @@ -1,6429 +0,0 @@ -{ - "id": "eae8306d-202e-45ca-a40b-206f318227ce", - "prevId": "d4d8f723-8996-465a-bf98-c51d8513ef1b", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "account_id": { - "name": "account_id", - "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 - }, - "access_token_expires_at": { - "name": "access_token_expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp with time zone", - "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 - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "session_token": { - "name": "session_token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "expires": { - "name": "expires", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_session_token_unique": { - "name": "session_session_token_unique", - "nullsNotDistinct": false, - "columns": ["session_token"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "email_verified": { - "name": "email_verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": 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()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "user_active_workspace_id_workspace_id_fk": { - "name": "user_active_workspace_id_workspace_id_fk", - "tableFrom": "user", - "tableTo": "workspace", - "columnsFrom": ["active_workspace_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user_api_key": { - "name": "user_api_key", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "key_preview": { - "name": "key_preview", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_hash": { - "name": "key_hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key_prefix": { - "name": "key_prefix", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "user_api_key_key_prefix_key_hash_index": { - "name": "user_api_key_key_prefix_key_hash_index", - "columns": [ - { - "expression": "key_prefix", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key_hash", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "user_api_key_user_id_user_id_fk": { - "name": "user_api_key_user_id_user_id_fk", - "tableFrom": "user_api_key", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.changelog_entry": { - "name": "changelog_entry", - "schema": "", - "columns": { - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "entity_data": { - "name": "entity_data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "changelog_entry_workspace_id_workspace_id_fk": { - "name": "changelog_entry_workspace_id_workspace_id_fk", - "tableFrom": "changelog_entry", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "changelog_entry_workspace_id_entity_type_entity_id_pk": { - "name": "changelog_entry_workspace_id_entity_type_entity_id_pk", - "columns": ["workspace_id", "entity_type", "entity_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard": { - "name": "dashboard", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_workspace_id_workspace_id_fk": { - "name": "dashboard_workspace_id_workspace_id_fk", - "tableFrom": "dashboard", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.dashboard_widget": { - "name": "dashboard_widget", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "dashboard_id": { - "name": "dashboard_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "widget": { - "name": "widget", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "x": { - "name": "x", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "y": { - "name": "y", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "w": { - "name": "w", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "h": { - "name": "h", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "dashboard_widget_dashboard_id_dashboard_id_fk": { - "name": "dashboard_widget_dashboard_id_dashboard_id_fk", - "tableFrom": "dashboard_widget", - "tableTo": "dashboard", - "columnsFrom": ["dashboard_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_plan": { - "name": "deployment_plan", - "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 - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version_tag": { - "name": "version_tag", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "version_name": { - "name": "version_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "version_config": { - "name": "version_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "version_job_agent_config": { - "name": "version_job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "version_metadata": { - "name": "version_metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "deployment_plan_workspace_id_index": { - "name": "deployment_plan_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_plan_deployment_id_index": { - "name": "deployment_plan_deployment_id_index", - "columns": [ - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_plan_expires_at_index": { - "name": "deployment_plan_expires_at_index", - "columns": [ - { - "expression": "expires_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_plan_workspace_id_workspace_id_fk": { - "name": "deployment_plan_workspace_id_workspace_id_fk", - "tableFrom": "deployment_plan", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_plan_deployment_id_deployment_id_fk": { - "name": "deployment_plan_deployment_id_deployment_id_fk", - "tableFrom": "deployment_plan", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_plan_target": { - "name": "deployment_plan_target", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "plan_id": { - "name": "plan_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "current_release_id": { - "name": "current_release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_plan_target_plan_id_index": { - "name": "deployment_plan_target_plan_id_index", - "columns": [ - { - "expression": "plan_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_plan_target_plan_id_environment_id_resource_id_index": { - "name": "deployment_plan_target_plan_id_environment_id_resource_id_index", - "columns": [ - { - "expression": "plan_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_plan_target_plan_id_deployment_plan_id_fk": { - "name": "deployment_plan_target_plan_id_deployment_plan_id_fk", - "tableFrom": "deployment_plan_target", - "tableTo": "deployment_plan", - "columnsFrom": ["plan_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_plan_target_environment_id_environment_id_fk": { - "name": "deployment_plan_target_environment_id_environment_id_fk", - "tableFrom": "deployment_plan_target", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_plan_target_resource_id_resource_id_fk": { - "name": "deployment_plan_target_resource_id_resource_id_fk", - "tableFrom": "deployment_plan_target", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "deployment_plan_target_current_release_id_release_id_fk": { - "name": "deployment_plan_target_current_release_id_release_id_fk", - "tableFrom": "deployment_plan_target", - "tableTo": "release", - "columnsFrom": ["current_release_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_plan_target_result": { - "name": "deployment_plan_target_result", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_id": { - "name": "target_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "dispatch_context": { - "name": "dispatch_context", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "agent_state": { - "name": "agent_state", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "deployment_plan_target_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'computing'" - }, - "has_changes": { - "name": "has_changes", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "current": { - "name": "current", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "proposed": { - "name": "proposed", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "started_at": { - "name": "started_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_plan_target_result_target_id_index": { - "name": "deployment_plan_target_result_target_id_index", - "columns": [ - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_plan_target_result_target_id_deployment_plan_target_id_fk": { - "name": "deployment_plan_target_result_target_id_deployment_plan_target_id_fk", - "tableFrom": "deployment_plan_target_result", - "tableTo": "deployment_plan_target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_plan_target_variable": { - "name": "deployment_plan_target_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "target_id": { - "name": "target_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 - }, - "encrypted": { - "name": "encrypted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "deployment_plan_target_variable_target_id_key_index": { - "name": "deployment_plan_target_variable_target_id_key_index", - "columns": [ - { - "expression": "target_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk": { - "name": "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk", - "tableFrom": "deployment_plan_target_variable", - "tableTo": "deployment_plan_target", - "columnsFrom": ["target_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_trace_span": { - "name": "deployment_trace_span", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "trace_id": { - "name": "trace_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "span_id": { - "name": "span_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "parent_span_id": { - "name": "parent_span_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "start_time": { - "name": "start_time", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "end_time": { - "name": "end_time", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_target_key": { - "name": "release_target_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "release_id": { - "name": "release_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "job_id": { - "name": "job_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "parent_trace_id": { - "name": "parent_trace_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "phase": { - "name": "phase", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "node_type": { - "name": "node_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "depth": { - "name": "depth", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "sequence": { - "name": "sequence", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "attributes": { - "name": "attributes", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "events": { - "name": "events", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "deployment_trace_span_trace_span_idx": { - "name": "deployment_trace_span_trace_span_idx", - "columns": [ - { - "expression": "trace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "span_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_trace_id_idx": { - "name": "deployment_trace_span_trace_id_idx", - "columns": [ - { - "expression": "trace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_parent_span_id_idx": { - "name": "deployment_trace_span_parent_span_id_idx", - "columns": [ - { - "expression": "parent_span_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_workspace_id_idx": { - "name": "deployment_trace_span_workspace_id_idx", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_release_target_key_idx": { - "name": "deployment_trace_span_release_target_key_idx", - "columns": [ - { - "expression": "release_target_key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_release_id_idx": { - "name": "deployment_trace_span_release_id_idx", - "columns": [ - { - "expression": "release_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_job_id_idx": { - "name": "deployment_trace_span_job_id_idx", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_parent_trace_id_idx": { - "name": "deployment_trace_span_parent_trace_id_idx", - "columns": [ - { - "expression": "parent_trace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_created_at_idx": { - "name": "deployment_trace_span_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_phase_idx": { - "name": "deployment_trace_span_phase_idx", - "columns": [ - { - "expression": "phase", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_node_type_idx": { - "name": "deployment_trace_span_node_type_idx", - "columns": [ - { - "expression": "node_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "deployment_trace_span_status_idx": { - "name": "deployment_trace_span_status_idx", - "columns": [ - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_trace_span_workspace_id_workspace_id_fk": { - "name": "deployment_trace_span_workspace_id_workspace_id_fk", - "tableFrom": "deployment_trace_span", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_variable": { - "name": "deployment_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "default_value": { - "name": "default_value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_variable_deployment_id_index": { - "name": "deployment_variable_deployment_id_index", - "columns": [ - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "deployment_variable_deployment_id_key_unique": { - "name": "deployment_variable_deployment_id_key_unique", - "nullsNotDistinct": false, - "columns": ["deployment_id", "key"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_variable_value": { - "name": "deployment_variable_value", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "deployment_variable_id": { - "name": "deployment_variable_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "resource_selector": { - "name": "resource_selector", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "priority": { - "name": "priority", - "type": "bigint", - "primaryKey": false, - "notNull": true, - "default": 0 - } - }, - "indexes": { - "deployment_variable_value_deployment_variable_id_index": { - "name": "deployment_variable_value_deployment_variable_id_index", - "columns": [ - { - "expression": "deployment_variable_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk": { - "name": "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk", - "tableFrom": "deployment_variable_value", - "tableTo": "deployment_variable", - "columnsFrom": ["deployment_variable_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment_version": { - "name": "deployment_version", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tag": { - "name": "tag", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "deployment_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'ready'" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp (3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "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_workspace_id_workspace_id_fk": { - "name": "deployment_version_workspace_id_workspace_id_fk", - "tableFrom": "deployment_version", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.computed_deployment_resource": { - "name": "computed_deployment_resource", - "schema": "", - "columns": { - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_evaluated_at": { - "name": "last_evaluated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "computed_deployment_resource_deployment_id_deployment_id_fk": { - "name": "computed_deployment_resource_deployment_id_deployment_id_fk", - "tableFrom": "computed_deployment_resource", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "computed_deployment_resource_resource_id_resource_id_fk": { - "name": "computed_deployment_resource_resource_id_resource_id_fk", - "tableFrom": "computed_deployment_resource", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "computed_deployment_resource_deployment_id_resource_id_pk": { - "name": "computed_deployment_resource_deployment_id_resource_id_pk", - "columns": ["deployment_id", "resource_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.deployment": { - "name": "deployment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "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": "'{}'" - }, - "job_agents": { - "name": "job_agents", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'" - }, - "resource_selector": { - "name": "resource_selector", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'false'" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "deployment_workspace_id_index": { - "name": "deployment_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "deployment_workspace_id_workspace_id_fk": { - "name": "deployment_workspace_id_workspace_id_fk", - "tableFrom": "deployment", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.computed_environment_resource": { - "name": "computed_environment_resource", - "schema": "", - "columns": { - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_evaluated_at": { - "name": "last_evaluated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "computed_environment_resource_environment_id_environment_id_fk": { - "name": "computed_environment_resource_environment_id_environment_id_fk", - "tableFrom": "computed_environment_resource", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "computed_environment_resource_resource_id_resource_id_fk": { - "name": "computed_environment_resource_resource_id_resource_id_fk", - "tableFrom": "computed_environment_resource", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "computed_environment_resource_environment_id_resource_id_pk": { - "name": "computed_environment_resource_environment_id_resource_id_pk", - "columns": ["environment_id", "resource_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.environment": { - "name": "environment", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "''" - }, - "resource_selector": { - "name": "resource_selector", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'false'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "environment_workspace_id_index": { - "name": "environment_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "environment_workspace_id_workspace_id_fk": { - "name": "environment_workspace_id_workspace_id_fk", - "tableFrom": "environment", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.event": { - "name": "event", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "payload": { - "name": "payload", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "event_workspace_id_workspace_id_fk": { - "name": "event_workspace_id_workspace_id_fk", - "tableFrom": "event", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "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": {} - }, - "resource_workspace_id_active_idx": { - "name": "resource_workspace_id_active_idx", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "resource_workspace_id_deleted_at_index": { - "name": "resource_workspace_id_deleted_at_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "deleted_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "resource_provider_id_resource_provider_id_fk": { - "name": "resource_provider_id_resource_provider_id_fk", - "tableFrom": "resource", - "tableTo": "resource_provider", - "columnsFrom": ["provider_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - }, - "resource_workspace_id_workspace_id_fk": { - "name": "resource_workspace_id_workspace_id_fk", - "tableFrom": "resource", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.resource_aggregate": { - "name": "resource_aggregate", - "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": 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 - }, - "created_by": { - "name": "created_by", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "filter": { - "name": "filter", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'true'" - }, - "group_by": { - "name": "group_by", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "resource_aggregate_workspace_id_index": { - "name": "resource_aggregate_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "resource_aggregate_workspace_id_workspace_id_fk": { - "name": "resource_aggregate_workspace_id_workspace_id_fk", - "tableFrom": "resource_aggregate", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "resource_aggregate_created_by_user_id_fk": { - "name": "resource_aggregate_created_by_user_id_fk", - "tableFrom": "resource_aggregate", - "tableTo": "user", - "columnsFrom": ["created_by"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.resource_schema": { - "name": "resource_schema", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version": { - "name": "version", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "json_schema": { - "name": "json_schema", - "type": "json", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "resource_schema_version_kind_workspace_id_index": { - "name": "resource_schema_version_kind_workspace_id_index", - "columns": [ - { - "expression": "version", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "resource_schema_workspace_id_workspace_id_fk": { - "name": "resource_schema_workspace_id_workspace_id_fk", - "tableFrom": "resource_schema", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.resource_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 with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - } - }, - "indexes": { - "resource_provider_workspace_id_name_index": { - "name": "resource_provider_workspace_id_name_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "resource_provider_workspace_id_workspace_id_fk": { - "name": "resource_provider_workspace_id_workspace_id_fk", - "tableFrom": "resource_provider", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - } - }, - "indexes": { - "system_workspace_id_index": { - "name": "system_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "system_workspace_id_workspace_id_fk": { - "name": "system_workspace_id_workspace_id_fk", - "tableFrom": "system", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.system_deployment": { - "name": "system_deployment", - "schema": "", - "columns": { - "system_id": { - "name": "system_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "system_deployment_system_id_system_id_fk": { - "name": "system_deployment_system_id_system_id_fk", - "tableFrom": "system_deployment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "system_deployment_deployment_id_deployment_id_fk": { - "name": "system_deployment_deployment_id_deployment_id_fk", - "tableFrom": "system_deployment", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "system_deployment_system_id_deployment_id_pk": { - "name": "system_deployment_system_id_deployment_id_pk", - "columns": ["system_id", "deployment_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.system_environment": { - "name": "system_environment", - "schema": "", - "columns": { - "system_id": { - "name": "system_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 with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "system_environment_system_id_system_id_fk": { - "name": "system_environment_system_id_system_id_fk", - "tableFrom": "system_environment", - "tableTo": "system", - "columnsFrom": ["system_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "system_environment_environment_id_environment_id_fk": { - "name": "system_environment_environment_id_environment_id_fk", - "tableFrom": "system_environment", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "system_environment_system_id_environment_id_pk": { - "name": "system_environment_system_id_environment_id_pk", - "columns": ["system_id", "environment_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.team": { - "name": "team", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "team_workspace_id_workspace_id_fk": { - "name": "team_workspace_id_workspace_id_fk", - "tableFrom": "team", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.team_member": { - "name": "team_member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "team_id": { - "name": "team_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "team_member_team_id_user_id_index": { - "name": "team_member_team_id_user_id_index", - "columns": [ - { - "expression": "team_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "team_member_team_id_team_id_fk": { - "name": "team_member_team_id_team_id_fk", - "tableFrom": "team_member", - "tableTo": "team", - "columnsFrom": ["team_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "team_member_user_id_user_id_fk": { - "name": "team_member_user_id_user_id_fk", - "tableFrom": "team_member", - "tableTo": "user", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job": { - "name": "job", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_agent_id": { - "name": "job_agent_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "job_agent_config": { - "name": "job_agent_config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "trace_token": { - "name": "trace_token", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "dispatch_context": { - "name": "dispatch_context", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "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": {} - }, - "job_external_id_idx": { - "name": "job_external_id_idx", - "columns": [ - { - "expression": "external_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_job_agent_id_job_agent_id_fk": { - "name": "job_job_agent_id_job_agent_id_fk", - "tableFrom": "job", - "tableTo": "job_agent", - "columnsFrom": ["job_agent_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job_metadata": { - "name": "job_metadata", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "job_metadata_key_job_id_index": { - "name": "job_metadata_key_job_id_index", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "job_metadata_job_id_idx": { - "name": "job_metadata_job_id_idx", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_metadata_job_id_job_id_fk": { - "name": "job_metadata_job_id_job_id_fk", - "tableFrom": "job_metadata", - "tableTo": "job", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job_variable": { - "name": "job_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "json", - "primaryKey": false, - "notNull": false - }, - "sensitive": { - "name": "sensitive", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "job_variable_job_id_key_index": { - "name": "job_variable_job_id_key_index", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_variable_job_id_job_id_fk": { - "name": "job_variable_job_id_job_id_fk", - "tableFrom": "job_variable", - "tableTo": "job", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workspace": { - "name": "workspace", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_slug_unique": { - "name": "workspace_slug_unique", - "nullsNotDistinct": false, - "columns": ["slug"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workspace_email_domain_matching": { - "name": "workspace_email_domain_matching", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "domain": { - "name": "domain", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role_id": { - "name": "role_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "verification_code": { - "name": "verification_code", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "verification_email": { - "name": "verification_email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "workspace_email_domain_matching_workspace_id_domain_index": { - "name": "workspace_email_domain_matching_workspace_id_domain_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "domain", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "workspace_email_domain_matching_workspace_id_workspace_id_fk": { - "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk", - "tableFrom": "workspace_email_domain_matching", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_email_domain_matching_role_id_role_id_fk": { - "name": "workspace_email_domain_matching_role_id_role_id_fk", - "tableFrom": "workspace_email_domain_matching", - "tableTo": "role", - "columnsFrom": ["role_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workspace_invite_token": { - "name": "workspace_invite_token", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "role_id": { - "name": "role_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "uuid", - "primaryKey": false, - "notNull": true, - "default": "gen_random_uuid()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "workspace_invite_token_role_id_role_id_fk": { - "name": "workspace_invite_token_role_id_role_id_fk", - "tableFrom": "workspace_invite_token", - "tableTo": "role", - "columnsFrom": ["role_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_invite_token_workspace_id_workspace_id_fk": { - "name": "workspace_invite_token_workspace_id_workspace_id_fk", - "tableFrom": "workspace_invite_token", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workspace_invite_token_created_by_user_id_fk": { - "name": "workspace_invite_token_created_by_user_id_fk", - "tableFrom": "workspace_invite_token", - "tableTo": "user", - "columnsFrom": ["created_by"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "workspace_invite_token_token_unique": { - "name": "workspace_invite_token_token_unique", - "nullsNotDistinct": false, - "columns": ["token"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.entity_role": { - "name": "entity_role", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "role_id": { - "name": "role_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "entity_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "entity_id": { - "name": "entity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "scope_id": { - "name": "scope_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "scope_type": { - "name": "scope_type", - "type": "scope_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": { - "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index", - "columns": [ - { - "expression": "role_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "entity_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "entity_role_role_id_role_id_fk": { - "name": "entity_role_role_id_role_id_fk", - "tableFrom": "entity_role", - "tableTo": "role", - "columnsFrom": ["role_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.role": { - "name": "role", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "role_workspace_id_workspace_id_fk": { - "name": "role_workspace_id_workspace_id_fk", - "tableFrom": "role", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.role_permission": { - "name": "role_permission", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "role_id": { - "name": "role_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "permission": { - "name": "permission", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "role_permission_role_id_permission_index": { - "name": "role_permission_role_id_permission_index", - "columns": [ - { - "expression": "role_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "permission", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "role_permission_role_id_role_id_fk": { - "name": "role_permission_role_id_role_id_fk", - "tableFrom": "role_permission", - "tableTo": "role", - "columnsFrom": ["role_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.release": { - "name": "release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version_id": { - "name": "version_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_resource_id_environment_id_deployment_id_index": { - "name": "release_resource_id_environment_id_deployment_id_index", - "columns": [ - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "release_deployment_id_index": { - "name": "release_deployment_id_index", - "columns": [ - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "release_resource_id_resource_id_fk": { - "name": "release_resource_id_resource_id_fk", - "tableFrom": "release", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_environment_id_environment_id_fk": { - "name": "release_environment_id_environment_id_fk", - "tableFrom": "release", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_deployment_id_deployment_id_fk": { - "name": "release_deployment_id_deployment_id_fk", - "tableFrom": "release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_version_id_deployment_version_id_fk": { - "name": "release_version_id_deployment_version_id_fk", - "tableFrom": "release", - "tableTo": "deployment_version", - "columnsFrom": ["version_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.release_job": { - "name": "release_job", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "release_job_release_id_job_id_index": { - "name": "release_job_release_id_job_id_index", - "columns": [ - { - "expression": "release_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "release_job_job_id_index": { - "name": "release_job_job_id_index", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "release_job_release_id_index": { - "name": "release_job_release_id_index", - "columns": [ - { - "expression": "release_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "release_job_job_id_job_id_fk": { - "name": "release_job_job_id_job_id_fk", - "tableFrom": "release_job", - "tableTo": "job", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_job_release_id_release_id_fk": { - "name": "release_job_release_id_release_id_fk", - "tableFrom": "release_job", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.release_target_desired_release": { - "name": "release_target_desired_release", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "desired_release_id": { - "name": "desired_release_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "release_target_desired_release_resource_id_environment_id_deployment_id_index": { - "name": "release_target_desired_release_resource_id_environment_id_deployment_id_index", - "columns": [ - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "release_target_desired_release_resource_id_resource_id_fk": { - "name": "release_target_desired_release_resource_id_resource_id_fk", - "tableFrom": "release_target_desired_release", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_target_desired_release_environment_id_environment_id_fk": { - "name": "release_target_desired_release_environment_id_environment_id_fk", - "tableFrom": "release_target_desired_release", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_target_desired_release_deployment_id_deployment_id_fk": { - "name": "release_target_desired_release_deployment_id_deployment_id_fk", - "tableFrom": "release_target_desired_release", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "release_target_desired_release_desired_release_id_release_id_fk": { - "name": "release_target_desired_release_desired_release_id_release_id_fk", - "tableFrom": "release_target_desired_release", - "tableTo": "release", - "columnsFrom": ["desired_release_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.release_variable": { - "name": "release_variable", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "release_id": { - "name": "release_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "encrypted": { - "name": "encrypted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "release_variable_release_id_key_index": { - "name": "release_variable_release_id_key_index", - "columns": [ - { - "expression": "release_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "release_variable_release_id_release_id_fk": { - "name": "release_variable_release_id_release_id_fk", - "tableFrom": "release_variable", - "tableTo": "release", - "columnsFrom": ["release_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.reconcile_work_scope": { - "name": "reconcile_work_scope", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "bigint", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "byDefault", - "name": "reconcile_work_scope_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "9223372036854775807", - "cache": "1", - "cycle": false - } - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "scope_type": { - "name": "scope_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "scope_id": { - "name": "scope_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "event_ts": { - "name": "event_ts", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "priority": { - "name": "priority", - "type": "smallint", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "not_before": { - "name": "not_before", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "attempt_count": { - "name": "attempt_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_by": { - "name": "claimed_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_until": { - "name": "claimed_until", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index": { - "name": "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "scope_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "reconcile_work_scope_unclaimed_idx": { - "name": "reconcile_work_scope_unclaimed_idx", - "columns": [ - { - "expression": "kind", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "priority", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "event_ts", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"reconcile_work_scope\".\"claimed_until\" is null", - "concurrently": false, - "method": "btree", - "with": {} - }, - "reconcile_work_scope_expired_claims_idx": { - "name": "reconcile_work_scope_expired_claims_idx", - "columns": [ - { - "expression": "claimed_until", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "where": "\"reconcile_work_scope\".\"claimed_until\" is not null", - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy": { - "name": "policy", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "selector": { - "name": "selector", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'true'" - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": 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()" - } - }, - "indexes": { - "policy_workspace_id_index": { - "name": "policy_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "policy_workspace_id_workspace_id_fk": { - "name": "policy_workspace_id_workspace_id_fk", - "tableFrom": "policy", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_any_approval": { - "name": "policy_rule_any_approval", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "min_approvals": { - "name": "min_approvals", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_any_approval_policy_id_policy_id_fk": { - "name": "policy_rule_any_approval_policy_id_policy_id_fk", - "tableFrom": "policy_rule_any_approval", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_deployment_dependency": { - "name": "policy_rule_deployment_dependency", - "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 - }, - "depends_on": { - "name": "depends_on", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_deployment_dependency_policy_id_policy_id_fk": { - "name": "policy_rule_deployment_dependency_policy_id_policy_id_fk", - "tableFrom": "policy_rule_deployment_dependency", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_deployment_window": { - "name": "policy_rule_deployment_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 - }, - "allow_window": { - "name": "allow_window", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "rrule": { - "name": "rrule", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_deployment_window_policy_id_policy_id_fk": { - "name": "policy_rule_deployment_window_policy_id_policy_id_fk", - "tableFrom": "policy_rule_deployment_window", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_environment_progression": { - "name": "policy_rule_environment_progression", - "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 - }, - "depends_on_environment_selector": { - "name": "depends_on_environment_selector", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "maximum_age_hours": { - "name": "maximum_age_hours", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "minimum_soak_time_minutes": { - "name": "minimum_soak_time_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "minimum_success_percentage": { - "name": "minimum_success_percentage", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "success_statuses": { - "name": "success_statuses", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_environment_progression_policy_id_policy_id_fk": { - "name": "policy_rule_environment_progression_policy_id_policy_id_fk", - "tableFrom": "policy_rule_environment_progression", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_gradual_rollout": { - "name": "policy_rule_gradual_rollout", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "rollout_type": { - "name": "rollout_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "time_scale_interval": { - "name": "time_scale_interval", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_gradual_rollout_policy_id_policy_id_fk": { - "name": "policy_rule_gradual_rollout_policy_id_policy_id_fk", - "tableFrom": "policy_rule_gradual_rollout", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_retry": { - "name": "policy_rule_retry", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "max_retries": { - "name": "max_retries", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "backoff_seconds": { - "name": "backoff_seconds", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "backoff_strategy": { - "name": "backoff_strategy", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_backoff_seconds": { - "name": "max_backoff_seconds", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "retry_on_statuses": { - "name": "retry_on_statuses", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_retry_policy_id_policy_id_fk": { - "name": "policy_rule_retry_policy_id_policy_id_fk", - "tableFrom": "policy_rule_retry", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_rollback": { - "name": "policy_rule_rollback", - "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 - }, - "on_job_statuses": { - "name": "on_job_statuses", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "on_verification_failure": { - "name": "on_verification_failure", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_rollback_policy_id_policy_id_fk": { - "name": "policy_rule_rollback_policy_id_policy_id_fk", - "tableFrom": "policy_rule_rollback", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_verification": { - "name": "policy_rule_verification", - "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 - }, - "metrics": { - "name": "metrics", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'" - }, - "trigger_on": { - "name": "trigger_on", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_verification_policy_id_policy_id_fk": { - "name": "policy_rule_verification_policy_id_policy_id_fk", - "tableFrom": "policy_rule_verification", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_version_cooldown": { - "name": "policy_rule_version_cooldown", - "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 - }, - "interval_seconds": { - "name": "interval_seconds", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_version_cooldown_policy_id_policy_id_fk": { - "name": "policy_rule_version_cooldown_policy_id_policy_id_fk", - "tableFrom": "policy_rule_version_cooldown", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_version_selector": { - "name": "policy_rule_version_selector", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "selector": { - "name": "selector", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_version_selector_policy_id_policy_id_fk": { - "name": "policy_rule_version_selector_policy_id_policy_id_fk", - "tableFrom": "policy_rule_version_selector", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user_approval_record": { - "name": "user_approval_record", - "schema": "", - "columns": { - "version_id": { - "name": "version_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": { - "user_approval_record_version_id_user_id_environment_id_pk": { - "name": "user_approval_record_version_id_user_id_environment_id_pk", - "columns": ["version_id", "user_id", "environment_id"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.resource_variable": { - "name": "resource_variable", - "schema": "", - "columns": { - "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 - } - }, - "indexes": {}, - "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": { - "resource_variable_resource_id_key_pk": { - "name": "resource_variable_resource_id_key_pk", - "columns": ["resource_id", "key"] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workflow": { - "name": "workflow", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "inputs": { - "name": "inputs", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'" - }, - "job_agents": { - "name": "job_agents", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'[]'" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "workflow_workspace_id_workspace_id_fk": { - "name": "workflow_workspace_id_workspace_id_fk", - "tableFrom": "workflow", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workflow_job": { - "name": "workflow_job", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workflow_run_id": { - "name": "workflow_run_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "workflow_job_workflow_run_id_workflow_run_id_fk": { - "name": "workflow_job_workflow_run_id_workflow_run_id_fk", - "tableFrom": "workflow_job", - "tableTo": "workflow_run", - "columnsFrom": ["workflow_run_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "workflow_job_job_id_job_id_fk": { - "name": "workflow_job_job_id_job_id_fk", - "tableFrom": "workflow_job", - "tableTo": "job", - "columnsFrom": ["job_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.workflow_run": { - "name": "workflow_run", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workflow_id": { - "name": "workflow_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "inputs": { - "name": "inputs", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - } - }, - "indexes": {}, - "foreignKeys": { - "workflow_run_workflow_id_workflow_id_fk": { - "name": "workflow_run_workflow_id_workflow_id_fk", - "tableFrom": "workflow_run", - "tableTo": "workflow", - "columnsFrom": ["workflow_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_skip": { - "name": "policy_skip", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "rule_id": { - "name": "rule_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version_id": { - "name": "version_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.computed_policy_release_target": { - "name": "computed_policy_release_target", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "deployment_id": { - "name": "deployment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "computed_at": { - "name": "computed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index": { - "name": "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index", - "columns": [ - { - "expression": "policy_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "computed_policy_release_target_policy_id_index": { - "name": "computed_policy_release_target_policy_id_index", - "columns": [ - { - "expression": "policy_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "computed_policy_release_target_resource_id_environment_id_deployment_id_index": { - "name": "computed_policy_release_target_resource_id_environment_id_deployment_id_index", - "columns": [ - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "deployment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "computed_policy_release_target_policy_id_policy_id_fk": { - "name": "computed_policy_release_target_policy_id_policy_id_fk", - "tableFrom": "computed_policy_release_target", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "computed_policy_release_target_environment_id_environment_id_fk": { - "name": "computed_policy_release_target_environment_id_environment_id_fk", - "tableFrom": "computed_policy_release_target", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "computed_policy_release_target_deployment_id_deployment_id_fk": { - "name": "computed_policy_release_target_deployment_id_deployment_id_fk", - "tableFrom": "computed_policy_release_target", - "tableTo": "deployment", - "columnsFrom": ["deployment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "computed_policy_release_target_resource_id_resource_id_fk": { - "name": "computed_policy_release_target_resource_id_resource_id_fk", - "tableFrom": "computed_policy_release_target", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_evaluation": { - "name": "policy_rule_evaluation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "rule_type": { - "name": "rule_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "rule_id": { - "name": "rule_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "environment_id": { - "name": "environment_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "version_id": { - "name": "version_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "resource_id": { - "name": "resource_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "allowed": { - "name": "allowed", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "action_required": { - "name": "action_required", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "action_type": { - "name": "action_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "satisfied_at": { - "name": "satisfied_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "next_evaluation_at": { - "name": "next_evaluation_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "evaluated_at": { - "name": "evaluated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index": { - "name": "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index", - "columns": [ - { - "expression": "rule_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "version_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index": { - "name": "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index", - "columns": [ - { - "expression": "environment_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "version_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "resource_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "rule_type", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "policy_rule_evaluation_environment_id_environment_id_fk": { - "name": "policy_rule_evaluation_environment_id_environment_id_fk", - "tableFrom": "policy_rule_evaluation", - "tableTo": "environment", - "columnsFrom": ["environment_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "policy_rule_evaluation_version_id_deployment_version_id_fk": { - "name": "policy_rule_evaluation_version_id_deployment_version_id_fk", - "tableFrom": "policy_rule_evaluation", - "tableTo": "deployment_version", - "columnsFrom": ["version_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "policy_rule_evaluation_resource_id_resource_id_fk": { - "name": "policy_rule_evaluation_resource_id_resource_id_fk", - "tableFrom": "policy_rule_evaluation", - "tableTo": "resource", - "columnsFrom": ["resource_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job_verification_metric_measurement": { - "name": "job_verification_metric_measurement", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "job_verification_metric_status_id": { - "name": "job_verification_metric_status_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "measured_at": { - "name": "measured_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "message": { - "name": "message", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "status": { - "name": "status", - "type": "job_verification_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "job_verification_metric_measurement_job_verification_metric_status_id_index": { - "name": "job_verification_metric_measurement_job_verification_metric_status_id_index", - "columns": [ - { - "expression": "job_verification_metric_status_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk": { - "name": "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk", - "tableFrom": "job_verification_metric_measurement", - "tableTo": "job_verification_metric", - "columnsFrom": ["job_verification_metric_status_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job_verification_metric": { - "name": "job_verification_metric", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "job_id": { - "name": "job_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "policy_rule_verification_metric_id": { - "name": "policy_rule_verification_metric_id", - "type": "uuid", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "interval_seconds": { - "name": "interval_seconds", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "success_condition": { - "name": "success_condition", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success_threshold": { - "name": "success_threshold", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "failure_condition": { - "name": "failure_condition", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'false'" - }, - "failure_threshold": { - "name": "failure_threshold", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": { - "job_verification_metric_job_id_index": { - "name": "job_verification_metric_job_id_index", - "columns": [ - { - "expression": "job_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "job_verification_metric_policy_rule_verification_metric_id_index": { - "name": "job_verification_metric_policy_rule_verification_metric_id_index", - "columns": [ - { - "expression": "policy_rule_verification_metric_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk": { - "name": "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk", - "tableFrom": "job_verification_metric", - "tableTo": "policy_rule_job_verification_metric", - "columnsFrom": ["policy_rule_verification_metric_id"], - "columnsTo": ["id"], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.policy_rule_job_verification_metric": { - "name": "policy_rule_job_verification_metric", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "trigger_on": { - "name": "trigger_on", - "type": "job_verification_trigger_on", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'jobSuccess'" - }, - "policy_id": { - "name": "policy_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider": { - "name": "provider", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "interval_seconds": { - "name": "interval_seconds", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "success_condition": { - "name": "success_condition", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "success_threshold": { - "name": "success_threshold", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "failure_condition": { - "name": "failure_condition", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'false'" - }, - "failure_threshold": { - "name": "failure_threshold", - "type": "integer", - "primaryKey": false, - "notNull": false, - "default": 0 - } - }, - "indexes": {}, - "foreignKeys": { - "policy_rule_job_verification_metric_policy_id_policy_id_fk": { - "name": "policy_rule_job_verification_metric_policy_id_policy_id_fk", - "tableFrom": "policy_rule_job_verification_metric", - "tableTo": "policy", - "columnsFrom": ["policy_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.computed_entity_relationship": { - "name": "computed_entity_relationship", - "schema": "", - "columns": { - "rule_id": { - "name": "rule_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "from_entity_type": { - "name": "from_entity_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "from_entity_id": { - "name": "from_entity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "to_entity_type": { - "name": "to_entity_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "to_entity_id": { - "name": "to_entity_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "last_evaluated_at": { - "name": "last_evaluated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "computed_entity_relationship_from_idx": { - "name": "computed_entity_relationship_from_idx", - "columns": [ - { - "expression": "from_entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "from_entity_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "computed_entity_relationship_to_idx": { - "name": "computed_entity_relationship_to_idx", - "columns": [ - { - "expression": "to_entity_type", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "to_entity_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "computed_entity_relationship_rule_id_relationship_rule_id_fk": { - "name": "computed_entity_relationship_rule_id_relationship_rule_id_fk", - "tableFrom": "computed_entity_relationship", - "tableTo": "relationship_rule", - "columnsFrom": ["rule_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk": { - "name": "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk", - "columns": [ - "rule_id", - "from_entity_type", - "from_entity_id", - "to_entity_type", - "to_entity_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.relationship_rule": { - "name": "relationship_rule", - "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": true - }, - "reference": { - "name": "reference", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "cel": { - "name": "cel", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - } - }, - "indexes": { - "relationship_rule_workspace_id_reference_index": { - "name": "relationship_rule_workspace_id_reference_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "reference", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "relationship_rule_workspace_id_index": { - "name": "relationship_rule_workspace_id_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "relationship_rule_workspace_id_workspace_id_fk": { - "name": "relationship_rule_workspace_id_workspace_id_fk", - "tableFrom": "relationship_rule", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.job_agent": { - "name": "job_agent", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "uuid", - "primaryKey": true, - "notNull": true, - "default": "gen_random_uuid()" - }, - "workspace_id": { - "name": "workspace_id", - "type": "uuid", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "config": { - "name": "config", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - } - }, - "indexes": { - "job_agent_workspace_id_name_index": { - "name": "job_agent_workspace_id_name_index", - "columns": [ - { - "expression": "workspace_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "job_agent_workspace_id_workspace_id_fk": { - "name": "job_agent_workspace_id_workspace_id_fk", - "tableFrom": "job_agent", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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": true, - "default": "''" - }, - "selector": { - "name": "selector", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'" - }, - "priority": { - "name": "priority", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "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": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "variable_set_workspace_id_workspace_id_fk": { - "name": "variable_set_workspace_id_workspace_id_fk", - "tableFrom": "variable_set", - "tableTo": "workspace", - "columnsFrom": ["workspace_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.variable_set_variable": { - "name": "variable_set_variable", - "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": {}, - "foreignKeys": { - "variable_set_variable_variable_set_id_variable_set_id_fk": { - "name": "variable_set_variable_variable_set_id_variable_set_id_fk", - "tableFrom": "variable_set_variable", - "tableTo": "variable_set", - "columnsFrom": ["variable_set_id"], - "columnsTo": ["id"], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "variable_set_variable_variable_set_id_key_unique": { - "name": "variable_set_variable_variable_set_id_key_unique", - "nullsNotDistinct": false, - "columns": ["variable_set_id", "key"] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.system_role": { - "name": "system_role", - "schema": "public", - "values": ["user", "admin"] - }, - "public.deployment_plan_target_status": { - "name": "deployment_plan_target_status", - "schema": "public", - "values": ["computing", "completed", "errored", "unsupported"] - }, - "public.deployment_version_status": { - "name": "deployment_version_status", - "schema": "public", - "values": [ - "unspecified", - "building", - "ready", - "failed", - "rejected", - "paused" - ] - }, - "public.job_reason": { - "name": "job_reason", - "schema": "public", - "values": [ - "policy_passing", - "policy_override", - "env_policy_override", - "config_policy_override", - "redeploy" - ] - }, - "public.job_status": { - "name": "job_status", - "schema": "public", - "values": [ - "cancelled", - "skipped", - "in_progress", - "action_required", - "pending", - "failure", - "invalid_job_agent", - "invalid_integration", - "external_run_not_found", - "successful" - ] - }, - "public.entity_type": { - "name": "entity_type", - "schema": "public", - "values": ["user", "team"] - }, - "public.scope_type": { - "name": "scope_type", - "schema": "public", - "values": [ - "deploymentVersion", - "resource", - "resourceProvider", - "workspace", - "environment", - "system", - "deployment" - ] - }, - "public.job_verification_status": { - "name": "job_verification_status", - "schema": "public", - "values": ["failed", "inconclusive", "passed"] - }, - "public.job_verification_trigger_on": { - "name": "job_verification_trigger_on", - "schema": "public", - "values": ["jobCreated", "jobStarted", "jobSuccess", "jobFailure"] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 7f3187517..8424ec0ad 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -1275,13 +1275,6 @@ "when": 1774151936030, "tag": "0181_wild_doctor_spectrum", "breakpoints": true - }, - { - "idx": 182, - "version": "7", - "when": 1775072628660, - "tag": "0182_silent_blazing_skull", - "breakpoints": true } ] } From 3920f475248acfc50543860fe8fa158f97fbfc8c Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Mon, 6 Apr 2026 11:03:26 -0700 Subject: [PATCH 09/10] add back migration --- .../db/drizzle/0183_even_layla_miller.sql | 22 + packages/db/drizzle/meta/0183_snapshot.json | 6465 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + 3 files changed, 6494 insertions(+) create mode 100644 packages/db/drizzle/0183_even_layla_miller.sql create mode 100644 packages/db/drizzle/meta/0183_snapshot.json diff --git a/packages/db/drizzle/0183_even_layla_miller.sql b/packages/db/drizzle/0183_even_layla_miller.sql new file mode 100644 index 000000000..c35dddd63 --- /dev/null +++ b/packages/db/drizzle/0183_even_layla_miller.sql @@ -0,0 +1,22 @@ +CREATE TABLE "variable_set" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text NOT NULL, + "description" text DEFAULT '' NOT NULL, + "selector" text NOT NULL, + "metadata" jsonb DEFAULT '{}' NOT NULL, + "priority" integer DEFAULT 0 NOT NULL, + "workspace_id" uuid NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "variable_set_variable" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "variable_set_id" uuid NOT NULL, + "key" text NOT NULL, + "value" jsonb NOT NULL, + CONSTRAINT "variable_set_variable_variable_set_id_key_unique" UNIQUE("variable_set_id","key") +); +--> statement-breakpoint +ALTER TABLE "variable_set" ADD CONSTRAINT "variable_set_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "variable_set_variable" ADD CONSTRAINT "variable_set_variable_variable_set_id_variable_set_id_fk" FOREIGN KEY ("variable_set_id") REFERENCES "public"."variable_set"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/packages/db/drizzle/meta/0183_snapshot.json b/packages/db/drizzle/meta/0183_snapshot.json new file mode 100644 index 000000000..0cb2cdfcc --- /dev/null +++ b/packages/db/drizzle/meta/0183_snapshot.json @@ -0,0 +1,6465 @@ +{ + "id": "81720e7b-cd18-4bae-a3fc-6ae05907172c", + "prevId": "6ebb240b-aeab-4d6e-848f-c098620b81e6", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "account_id": { + "name": "account_id", + "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 + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "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 + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_session_token_unique": { + "name": "session_session_token_unique", + "nullsNotDistinct": false, + "columns": ["session_token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": 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()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_active_workspace_id_workspace_id_fk": { + "name": "user_active_workspace_id_workspace_id_fk", + "tableFrom": "user", + "tableTo": "workspace", + "columnsFrom": ["active_workspace_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_api_key": { + "name": "user_api_key", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_prefix": { + "name": "key_prefix", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "user_api_key_key_prefix_key_hash_index": { + "name": "user_api_key_key_prefix_key_hash_index", + "columns": [ + { + "expression": "key_prefix", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "user_api_key_user_id_user_id_fk": { + "name": "user_api_key_user_id_user_id_fk", + "tableFrom": "user_api_key", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.changelog_entry": { + "name": "changelog_entry", + "schema": "", + "columns": { + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "entity_data": { + "name": "entity_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_entry_workspace_id_workspace_id_fk": { + "name": "changelog_entry_workspace_id_workspace_id_fk", + "tableFrom": "changelog_entry", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "changelog_entry_workspace_id_entity_type_entity_id_pk": { + "name": "changelog_entry_workspace_id_entity_type_entity_id_pk", + "columns": ["workspace_id", "entity_type", "entity_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dashboard": { + "name": "dashboard", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_workspace_id_workspace_id_fk": { + "name": "dashboard_workspace_id_workspace_id_fk", + "tableFrom": "dashboard", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dashboard_widget": { + "name": "dashboard_widget", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dashboard_id": { + "name": "dashboard_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "widget": { + "name": "widget", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "x": { + "name": "x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "w": { + "name": "w", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "h": { + "name": "h", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "dashboard_widget_dashboard_id_dashboard_id_fk": { + "name": "dashboard_widget_dashboard_id_dashboard_id_fk", + "tableFrom": "dashboard_widget", + "tableTo": "dashboard", + "columnsFrom": ["dashboard_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan": { + "name": "deployment_plan", + "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 + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_tag": { + "name": "version_tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_name": { + "name": "version_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version_config": { + "name": "version_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "version_job_agent_config": { + "name": "version_job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "version_metadata": { + "name": "version_metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "deployment_plan_workspace_id_index": { + "name": "deployment_plan_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_deployment_id_index": { + "name": "deployment_plan_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_expires_at_index": { + "name": "deployment_plan_expires_at_index", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_workspace_id_workspace_id_fk": { + "name": "deployment_plan_workspace_id_workspace_id_fk", + "tableFrom": "deployment_plan", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_deployment_id_deployment_id_fk": { + "name": "deployment_plan_deployment_id_deployment_id_fk", + "tableFrom": "deployment_plan", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target": { + "name": "deployment_plan_target", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "plan_id": { + "name": "plan_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "current_release_id": { + "name": "current_release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_plan_target_plan_id_index": { + "name": "deployment_plan_target_plan_id_index", + "columns": [ + { + "expression": "plan_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_plan_target_plan_id_environment_id_resource_id_index": { + "name": "deployment_plan_target_plan_id_environment_id_resource_id_index", + "columns": [ + { + "expression": "plan_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_plan_id_deployment_plan_id_fk": { + "name": "deployment_plan_target_plan_id_deployment_plan_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "deployment_plan", + "columnsFrom": ["plan_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_environment_id_environment_id_fk": { + "name": "deployment_plan_target_environment_id_environment_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_resource_id_resource_id_fk": { + "name": "deployment_plan_target_resource_id_resource_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_plan_target_current_release_id_release_id_fk": { + "name": "deployment_plan_target_current_release_id_release_id_fk", + "tableFrom": "deployment_plan_target", + "tableTo": "release", + "columnsFrom": ["current_release_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target_result": { + "name": "deployment_plan_target_result", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "dispatch_context": { + "name": "dispatch_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "agent_state": { + "name": "agent_state", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "deployment_plan_target_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'computing'" + }, + "has_changes": { + "name": "has_changes", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "current": { + "name": "current", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "proposed": { + "name": "proposed", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_plan_target_result_target_id_index": { + "name": "deployment_plan_target_result_target_id_index", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_result_target_id_deployment_plan_target_id_fk": { + "name": "deployment_plan_target_result_target_id_deployment_plan_target_id_fk", + "tableFrom": "deployment_plan_target_result", + "tableTo": "deployment_plan_target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_plan_target_variable": { + "name": "deployment_plan_target_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "target_id": { + "name": "target_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 + }, + "encrypted": { + "name": "encrypted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "deployment_plan_target_variable_target_id_key_index": { + "name": "deployment_plan_target_variable_target_id_key_index", + "columns": [ + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk": { + "name": "deployment_plan_target_variable_target_id_deployment_plan_target_id_fk", + "tableFrom": "deployment_plan_target_variable", + "tableTo": "deployment_plan_target", + "columnsFrom": ["target_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_trace_span": { + "name": "deployment_trace_span", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "trace_id": { + "name": "trace_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "span_id": { + "name": "span_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_span_id": { + "name": "parent_span_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "start_time": { + "name": "start_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "end_time": { + "name": "end_time", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_target_key": { + "name": "release_target_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "release_id": { + "name": "release_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "job_id": { + "name": "job_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_trace_id": { + "name": "parent_trace_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phase": { + "name": "phase", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "node_type": { + "name": "node_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "depth": { + "name": "depth", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "attributes": { + "name": "attributes", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "events": { + "name": "events", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "deployment_trace_span_trace_span_idx": { + "name": "deployment_trace_span_trace_span_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "span_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_trace_id_idx": { + "name": "deployment_trace_span_trace_id_idx", + "columns": [ + { + "expression": "trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_parent_span_id_idx": { + "name": "deployment_trace_span_parent_span_id_idx", + "columns": [ + { + "expression": "parent_span_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_workspace_id_idx": { + "name": "deployment_trace_span_workspace_id_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_release_target_key_idx": { + "name": "deployment_trace_span_release_target_key_idx", + "columns": [ + { + "expression": "release_target_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_release_id_idx": { + "name": "deployment_trace_span_release_id_idx", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_job_id_idx": { + "name": "deployment_trace_span_job_id_idx", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_parent_trace_id_idx": { + "name": "deployment_trace_span_parent_trace_id_idx", + "columns": [ + { + "expression": "parent_trace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_created_at_idx": { + "name": "deployment_trace_span_created_at_idx", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_phase_idx": { + "name": "deployment_trace_span_phase_idx", + "columns": [ + { + "expression": "phase", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_node_type_idx": { + "name": "deployment_trace_span_node_type_idx", + "columns": [ + { + "expression": "node_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "deployment_trace_span_status_idx": { + "name": "deployment_trace_span_status_idx", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_trace_span_workspace_id_workspace_id_fk": { + "name": "deployment_trace_span_workspace_id_workspace_id_fk", + "tableFrom": "deployment_trace_span", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_variable": { + "name": "deployment_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_value": { + "name": "default_value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_variable_deployment_id_index": { + "name": "deployment_variable_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "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" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "deployment_variable_deployment_id_key_unique": { + "name": "deployment_variable_deployment_id_key_unique", + "nullsNotDistinct": false, + "columns": ["deployment_id", "key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_variable_value": { + "name": "deployment_variable_value", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "deployment_variable_id": { + "name": "deployment_variable_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "priority": { + "name": "priority", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "deployment_variable_value_deployment_variable_id_index": { + "name": "deployment_variable_value_deployment_variable_id_index", + "columns": [ + { + "expression": "deployment_variable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk": { + "name": "deployment_variable_value_deployment_variable_id_deployment_variable_id_fk", + "tableFrom": "deployment_variable_value", + "tableTo": "deployment_variable", + "columnsFrom": ["deployment_variable_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_version": { + "name": "deployment_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "deployment_version_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'ready'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp (3) with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "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_workspace_id_workspace_id_fk": { + "name": "deployment_version_workspace_id_workspace_id_fk", + "tableFrom": "deployment_version", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_deployment_resource": { + "name": "computed_deployment_resource", + "schema": "", + "columns": { + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "computed_deployment_resource_deployment_id_deployment_id_fk": { + "name": "computed_deployment_resource_deployment_id_deployment_id_fk", + "tableFrom": "computed_deployment_resource", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_deployment_resource_resource_id_resource_id_fk": { + "name": "computed_deployment_resource_resource_id_resource_id_fk", + "tableFrom": "computed_deployment_resource", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_deployment_resource_deployment_id_resource_id_pk": { + "name": "computed_deployment_resource_deployment_id_resource_id_pk", + "columns": ["deployment_id", "resource_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment": { + "name": "deployment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "deployment_workspace_id_index": { + "name": "deployment_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "deployment_workspace_id_workspace_id_fk": { + "name": "deployment_workspace_id_workspace_id_fk", + "tableFrom": "deployment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_job_agent": { + "name": "deployment_job_agent", + "schema": "", + "columns": { + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "deployment_job_agent_deployment_id_deployment_id_fk": { + "name": "deployment_job_agent_deployment_id_deployment_id_fk", + "tableFrom": "deployment_job_agent", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "deployment_job_agent_job_agent_id_job_agent_id_fk": { + "name": "deployment_job_agent_job_agent_id_job_agent_id_fk", + "tableFrom": "deployment_job_agent", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "deployment_job_agent_deployment_id_job_agent_id_pk": { + "name": "deployment_job_agent_deployment_id_job_agent_id_pk", + "columns": ["deployment_id", "job_agent_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_environment_resource": { + "name": "computed_environment_resource", + "schema": "", + "columns": { + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "computed_environment_resource_environment_id_environment_id_fk": { + "name": "computed_environment_resource_environment_id_environment_id_fk", + "tableFrom": "computed_environment_resource", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_environment_resource_resource_id_resource_id_fk": { + "name": "computed_environment_resource_resource_id_resource_id_fk", + "tableFrom": "computed_environment_resource", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_environment_resource_environment_id_resource_id_pk": { + "name": "computed_environment_resource_environment_id_resource_id_pk", + "columns": ["environment_id", "resource_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.environment": { + "name": "environment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "resource_selector": { + "name": "resource_selector", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "environment_workspace_id_index": { + "name": "environment_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "environment_workspace_id_workspace_id_fk": { + "name": "environment_workspace_id_workspace_id_fk", + "tableFrom": "environment", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.event": { + "name": "event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "event_workspace_id_workspace_id_fk": { + "name": "event_workspace_id_workspace_id_fk", + "tableFrom": "event", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + }, + "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": {} + }, + "resource_workspace_id_active_idx": { + "name": "resource_workspace_id_active_idx", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "resource_workspace_id_deleted_at_index": { + "name": "resource_workspace_id_deleted_at_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_id_resource_provider_id_fk": { + "name": "resource_provider_id_resource_provider_id_fk", + "tableFrom": "resource", + "tableTo": "resource_provider", + "columnsFrom": ["provider_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + }, + "resource_workspace_id_workspace_id_fk": { + "name": "resource_workspace_id_workspace_id_fk", + "tableFrom": "resource", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_aggregate": { + "name": "resource_aggregate", + "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": 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 + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "filter": { + "name": "filter", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'true'" + }, + "group_by": { + "name": "group_by", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "resource_aggregate_workspace_id_index": { + "name": "resource_aggregate_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_aggregate_workspace_id_workspace_id_fk": { + "name": "resource_aggregate_workspace_id_workspace_id_fk", + "tableFrom": "resource_aggregate", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + }, + "resource_aggregate_created_by_user_id_fk": { + "name": "resource_aggregate_created_by_user_id_fk", + "tableFrom": "resource_aggregate", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_schema": { + "name": "resource_schema", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "json_schema": { + "name": "json_schema", + "type": "json", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "resource_schema_version_kind_workspace_id_index": { + "name": "resource_schema_version_kind_workspace_id_index", + "columns": [ + { + "expression": "version", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_schema_workspace_id_workspace_id_fk": { + "name": "resource_schema_workspace_id_workspace_id_fk", + "tableFrom": "resource_schema", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_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 with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "resource_provider_workspace_id_name_index": { + "name": "resource_provider_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "resource_provider_workspace_id_workspace_id_fk": { + "name": "resource_provider_workspace_id_workspace_id_fk", + "tableFrom": "resource_provider", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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 + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "system_workspace_id_index": { + "name": "system_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "system_workspace_id_workspace_id_fk": { + "name": "system_workspace_id_workspace_id_fk", + "tableFrom": "system", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.system_deployment": { + "name": "system_deployment", + "schema": "", + "columns": { + "system_id": { + "name": "system_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "system_deployment_system_id_system_id_fk": { + "name": "system_deployment_system_id_system_id_fk", + "tableFrom": "system_deployment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "system_deployment_deployment_id_deployment_id_fk": { + "name": "system_deployment_deployment_id_deployment_id_fk", + "tableFrom": "system_deployment", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "system_deployment_system_id_deployment_id_pk": { + "name": "system_deployment_system_id_deployment_id_pk", + "columns": ["system_id", "deployment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.system_environment": { + "name": "system_environment", + "schema": "", + "columns": { + "system_id": { + "name": "system_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 with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "system_environment_system_id_system_id_fk": { + "name": "system_environment_system_id_system_id_fk", + "tableFrom": "system_environment", + "tableTo": "system", + "columnsFrom": ["system_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "system_environment_environment_id_environment_id_fk": { + "name": "system_environment_environment_id_environment_id_fk", + "tableFrom": "system_environment", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "system_environment_system_id_environment_id_pk": { + "name": "system_environment_system_id_environment_id_pk", + "columns": ["system_id", "environment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.team": { + "name": "team", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "team_workspace_id_workspace_id_fk": { + "name": "team_workspace_id_workspace_id_fk", + "tableFrom": "team", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.team_member": { + "name": "team_member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "team_id": { + "name": "team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "team_member_team_id_user_id_index": { + "name": "team_member_team_id_user_id_index", + "columns": [ + { + "expression": "team_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "team_member_team_id_team_id_fk": { + "name": "team_member_team_id_team_id_fk", + "tableFrom": "team_member", + "tableTo": "team", + "columnsFrom": ["team_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_member_user_id_user_id_fk": { + "name": "team_member_user_id_user_id_fk", + "tableFrom": "team_member", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job": { + "name": "job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_agent_id": { + "name": "job_agent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "job_agent_config": { + "name": "job_agent_config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "trace_token": { + "name": "trace_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dispatch_context": { + "name": "dispatch_context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "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": {} + }, + "job_external_id_idx": { + "name": "job_external_id_idx", + "columns": [ + { + "expression": "external_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_job_agent_id_job_agent_id_fk": { + "name": "job_job_agent_id_job_agent_id_fk", + "tableFrom": "job", + "tableTo": "job_agent", + "columnsFrom": ["job_agent_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_metadata": { + "name": "job_metadata", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_metadata_key_job_id_index": { + "name": "job_metadata_key_job_id_index", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_metadata_job_id_idx": { + "name": "job_metadata_job_id_idx", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_metadata_job_id_job_id_fk": { + "name": "job_metadata_job_id_job_id_fk", + "tableFrom": "job_metadata", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_variable": { + "name": "job_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "job_variable_job_id_key_index": { + "name": "job_variable_job_id_key_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_variable_job_id_job_id_fk": { + "name": "job_variable_job_id_job_id_fk", + "tableFrom": "job_variable", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_slug_unique": { + "name": "workspace_slug_unique", + "nullsNotDistinct": false, + "columns": ["slug"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_email_domain_matching": { + "name": "workspace_email_domain_matching", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "domain": { + "name": "domain", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "verification_code": { + "name": "verification_code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verification_email": { + "name": "verification_email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "workspace_email_domain_matching_workspace_id_domain_index": { + "name": "workspace_email_domain_matching_workspace_id_domain_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "domain", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_email_domain_matching_workspace_id_workspace_id_fk": { + "name": "workspace_email_domain_matching_workspace_id_workspace_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_email_domain_matching_role_id_role_id_fk": { + "name": "workspace_email_domain_matching_role_id_role_id_fk", + "tableFrom": "workspace_email_domain_matching", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_invite_token": { + "name": "workspace_invite_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "uuid", + "primaryKey": false, + "notNull": true, + "default": "gen_random_uuid()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_invite_token_role_id_role_id_fk": { + "name": "workspace_invite_token_role_id_role_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_workspace_id_workspace_id_fk": { + "name": "workspace_invite_token_workspace_id_workspace_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_invite_token_created_by_user_id_fk": { + "name": "workspace_invite_token_created_by_user_id_fk", + "tableFrom": "workspace_invite_token", + "tableTo": "user", + "columnsFrom": ["created_by"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "workspace_invite_token_token_unique": { + "name": "workspace_invite_token_token_unique", + "nullsNotDistinct": false, + "columns": ["token"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.entity_role": { + "name": "entity_role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_type": { + "name": "entity_type", + "type": "entity_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "scope_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index": { + "name": "entity_role_role_id_entity_type_entity_id_scope_id_scope_type_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "entity_role_role_id_role_id_fk": { + "name": "entity_role_role_id_role_id_fk", + "tableFrom": "entity_role", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "role_workspace_id_workspace_id_fk": { + "name": "role_workspace_id_workspace_id_fk", + "tableFrom": "role", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.role_permission": { + "name": "role_permission", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "role_id": { + "name": "role_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "role_permission_role_id_permission_index": { + "name": "role_permission_role_id_permission_index", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "permission", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "role_permission_role_id_role_id_fk": { + "name": "role_permission_role_id_role_id_fk", + "tableFrom": "role_permission", + "tableTo": "role", + "columnsFrom": ["role_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release": { + "name": "release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_resource_id_environment_id_deployment_id_index": { + "name": "release_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_deployment_id_index": { + "name": "release_deployment_id_index", + "columns": [ + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_resource_id_resource_id_fk": { + "name": "release_resource_id_resource_id_fk", + "tableFrom": "release", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_environment_id_environment_id_fk": { + "name": "release_environment_id_environment_id_fk", + "tableFrom": "release", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_deployment_id_deployment_id_fk": { + "name": "release_deployment_id_deployment_id_fk", + "tableFrom": "release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_version_id_deployment_version_id_fk": { + "name": "release_version_id_deployment_version_id_fk", + "tableFrom": "release", + "tableTo": "deployment_version", + "columnsFrom": ["version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_job": { + "name": "release_job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "release_job_release_id_job_id_index": { + "name": "release_job_release_id_job_id_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_job_job_id_index": { + "name": "release_job_job_id_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "release_job_release_id_index": { + "name": "release_job_release_id_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_job_job_id_job_id_fk": { + "name": "release_job_job_id_job_id_fk", + "tableFrom": "release_job", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_job_release_id_release_id_fk": { + "name": "release_job_release_id_release_id_fk", + "tableFrom": "release_job", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_target_desired_release": { + "name": "release_target_desired_release", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "desired_release_id": { + "name": "desired_release_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "release_target_desired_release_resource_id_environment_id_deployment_id_index": { + "name": "release_target_desired_release_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_target_desired_release_resource_id_resource_id_fk": { + "name": "release_target_desired_release_resource_id_resource_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_environment_id_environment_id_fk": { + "name": "release_target_desired_release_environment_id_environment_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_deployment_id_deployment_id_fk": { + "name": "release_target_desired_release_deployment_id_deployment_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "release_target_desired_release_desired_release_id_release_id_fk": { + "name": "release_target_desired_release_desired_release_id_release_id_fk", + "tableFrom": "release_target_desired_release", + "tableTo": "release", + "columnsFrom": ["desired_release_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.release_variable": { + "name": "release_variable", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "release_id": { + "name": "release_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "encrypted": { + "name": "encrypted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "release_variable_release_id_key_index": { + "name": "release_variable_release_id_key_index", + "columns": [ + { + "expression": "release_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "release_variable_release_id_release_id_fk": { + "name": "release_variable_release_id_release_id_fk", + "tableFrom": "release_variable", + "tableTo": "release", + "columnsFrom": ["release_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.reconcile_work_scope": { + "name": "reconcile_work_scope", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigint", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "reconcile_work_scope_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": "1", + "cycle": false + } + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope_type": { + "name": "scope_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "scope_id": { + "name": "scope_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "event_ts": { + "name": "event_ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "priority": { + "name": "priority", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 100 + }, + "not_before": { + "name": "not_before", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "attempt_count": { + "name": "attempt_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "claimed_by": { + "name": "claimed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "claimed_until": { + "name": "claimed_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index": { + "name": "reconcile_work_scope_workspace_id_kind_scope_type_scope_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "reconcile_work_scope_unclaimed_idx": { + "name": "reconcile_work_scope_unclaimed_idx", + "columns": [ + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "priority", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_ts", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"reconcile_work_scope\".\"claimed_until\" is null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "reconcile_work_scope_expired_claims_idx": { + "name": "reconcile_work_scope_expired_claims_idx", + "columns": [ + { + "expression": "claimed_until", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"reconcile_work_scope\".\"claimed_until\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy": { + "name": "policy", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'true'" + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": 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()" + } + }, + "indexes": { + "policy_workspace_id_index": { + "name": "policy_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "policy_workspace_id_workspace_id_fk": { + "name": "policy_workspace_id_workspace_id_fk", + "tableFrom": "policy", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_any_approval": { + "name": "policy_rule_any_approval", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "min_approvals": { + "name": "min_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_any_approval_policy_id_policy_id_fk": { + "name": "policy_rule_any_approval_policy_id_policy_id_fk", + "tableFrom": "policy_rule_any_approval", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_deployment_dependency": { + "name": "policy_rule_deployment_dependency", + "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 + }, + "depends_on": { + "name": "depends_on", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_deployment_dependency_policy_id_policy_id_fk": { + "name": "policy_rule_deployment_dependency_policy_id_policy_id_fk", + "tableFrom": "policy_rule_deployment_dependency", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_deployment_window": { + "name": "policy_rule_deployment_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 + }, + "allow_window": { + "name": "allow_window", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "rrule": { + "name": "rrule", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_deployment_window_policy_id_policy_id_fk": { + "name": "policy_rule_deployment_window_policy_id_policy_id_fk", + "tableFrom": "policy_rule_deployment_window", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_environment_progression": { + "name": "policy_rule_environment_progression", + "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 + }, + "depends_on_environment_selector": { + "name": "depends_on_environment_selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "maximum_age_hours": { + "name": "maximum_age_hours", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "minimum_soak_time_minutes": { + "name": "minimum_soak_time_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "minimum_success_percentage": { + "name": "minimum_success_percentage", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "success_statuses": { + "name": "success_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_environment_progression_policy_id_policy_id_fk": { + "name": "policy_rule_environment_progression_policy_id_policy_id_fk", + "tableFrom": "policy_rule_environment_progression", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_gradual_rollout": { + "name": "policy_rule_gradual_rollout", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rollout_type": { + "name": "rollout_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "time_scale_interval": { + "name": "time_scale_interval", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_gradual_rollout_policy_id_policy_id_fk": { + "name": "policy_rule_gradual_rollout_policy_id_policy_id_fk", + "tableFrom": "policy_rule_gradual_rollout", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_retry": { + "name": "policy_rule_retry", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "max_retries": { + "name": "max_retries", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "backoff_seconds": { + "name": "backoff_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "backoff_strategy": { + "name": "backoff_strategy", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_backoff_seconds": { + "name": "max_backoff_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "retry_on_statuses": { + "name": "retry_on_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_retry_policy_id_policy_id_fk": { + "name": "policy_rule_retry_policy_id_policy_id_fk", + "tableFrom": "policy_rule_retry", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_rollback": { + "name": "policy_rule_rollback", + "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 + }, + "on_job_statuses": { + "name": "on_job_statuses", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "on_verification_failure": { + "name": "on_verification_failure", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_rollback_policy_id_policy_id_fk": { + "name": "policy_rule_rollback_policy_id_policy_id_fk", + "tableFrom": "policy_rule_rollback", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_verification": { + "name": "policy_rule_verification", + "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 + }, + "metrics": { + "name": "metrics", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "trigger_on": { + "name": "trigger_on", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_verification_policy_id_policy_id_fk": { + "name": "policy_rule_verification_policy_id_policy_id_fk", + "tableFrom": "policy_rule_verification", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_version_cooldown": { + "name": "policy_rule_version_cooldown", + "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 + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_version_cooldown_policy_id_policy_id_fk": { + "name": "policy_rule_version_cooldown_policy_id_policy_id_fk", + "tableFrom": "policy_rule_version_cooldown", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_version_selector": { + "name": "policy_rule_version_selector", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_version_selector_policy_id_policy_id_fk": { + "name": "policy_rule_version_selector_policy_id_policy_id_fk", + "tableFrom": "policy_rule_version_selector", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_approval_record": { + "name": "user_approval_record", + "schema": "", + "columns": { + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "user_approval_record_version_id_user_id_environment_id_pk": { + "name": "user_approval_record_version_id_user_id_environment_id_pk", + "columns": ["version_id", "user_id", "environment_id"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.resource_variable": { + "name": "resource_variable", + "schema": "", + "columns": { + "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 + } + }, + "indexes": {}, + "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": { + "resource_variable_resource_id_key_pk": { + "name": "resource_variable_resource_id_key_pk", + "columns": ["resource_id", "key"] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow": { + "name": "workflow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inputs": { + "name": "inputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "job_agents": { + "name": "job_agents", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_workspace_id_workspace_id_fk": { + "name": "workflow_workspace_id_workspace_id_fk", + "tableFrom": "workflow", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_job": { + "name": "workflow_job", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workflow_run_id": { + "name": "workflow_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_job_workflow_run_id_workflow_run_id_fk": { + "name": "workflow_job_workflow_run_id_workflow_run_id_fk", + "tableFrom": "workflow_job", + "tableTo": "workflow_run", + "columnsFrom": ["workflow_run_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workflow_job_job_id_job_id_fk": { + "name": "workflow_job_job_id_job_id_fk", + "tableFrom": "workflow_job", + "tableTo": "job", + "columnsFrom": ["job_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workflow_run": { + "name": "workflow_run", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workflow_id": { + "name": "workflow_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "inputs": { + "name": "inputs", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "workflow_run_workflow_id_workflow_id_fk": { + "name": "workflow_run_workflow_id_workflow_id_fk", + "tableFrom": "workflow_run", + "tableTo": "workflow", + "columnsFrom": ["workflow_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_skip": { + "name": "policy_skip", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_policy_release_target": { + "name": "computed_policy_release_target", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deployment_id": { + "name": "deployment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "computed_at": { + "name": "computed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index": { + "name": "computed_policy_release_target_policy_id_environment_id_deployment_id_resource_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_policy_release_target_policy_id_index": { + "name": "computed_policy_release_target_policy_id_index", + "columns": [ + { + "expression": "policy_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_policy_release_target_resource_id_environment_id_deployment_id_index": { + "name": "computed_policy_release_target_resource_id_environment_id_deployment_id_index", + "columns": [ + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "deployment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "computed_policy_release_target_policy_id_policy_id_fk": { + "name": "computed_policy_release_target_policy_id_policy_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_environment_id_environment_id_fk": { + "name": "computed_policy_release_target_environment_id_environment_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_deployment_id_deployment_id_fk": { + "name": "computed_policy_release_target_deployment_id_deployment_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "deployment", + "columnsFrom": ["deployment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "computed_policy_release_target_resource_id_resource_id_fk": { + "name": "computed_policy_release_target_resource_id_resource_id_fk", + "tableFrom": "computed_policy_release_target", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_evaluation": { + "name": "policy_rule_evaluation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "rule_type": { + "name": "rule_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "environment_id": { + "name": "environment_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version_id": { + "name": "version_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resource_id": { + "name": "resource_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "allowed": { + "name": "allowed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "action_required": { + "name": "action_required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "action_type": { + "name": "action_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "details": { + "name": "details", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "satisfied_at": { + "name": "satisfied_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "next_evaluation_at": { + "name": "next_evaluation_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "evaluated_at": { + "name": "evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index": { + "name": "policy_rule_evaluation_rule_id_environment_id_version_id_resource_id_index", + "columns": [ + { + "expression": "rule_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index": { + "name": "policy_rule_evaluation_environment_id_version_id_resource_id_rule_type_index", + "columns": [ + { + "expression": "environment_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "version_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "resource_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "rule_type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "policy_rule_evaluation_environment_id_environment_id_fk": { + "name": "policy_rule_evaluation_environment_id_environment_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "environment", + "columnsFrom": ["environment_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "policy_rule_evaluation_version_id_deployment_version_id_fk": { + "name": "policy_rule_evaluation_version_id_deployment_version_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "deployment_version", + "columnsFrom": ["version_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "policy_rule_evaluation_resource_id_resource_id_fk": { + "name": "policy_rule_evaluation_resource_id_resource_id_fk", + "tableFrom": "policy_rule_evaluation", + "tableTo": "resource", + "columnsFrom": ["resource_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_verification_metric_measurement": { + "name": "job_verification_metric_measurement", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_verification_metric_status_id": { + "name": "job_verification_metric_status_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "measured_at": { + "name": "measured_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "status": { + "name": "status", + "type": "job_verification_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "job_verification_metric_measurement_job_verification_metric_status_id_index": { + "name": "job_verification_metric_measurement_job_verification_metric_status_id_index", + "columns": [ + { + "expression": "job_verification_metric_status_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk": { + "name": "job_verification_metric_measurement_job_verification_metric_status_id_job_verification_metric_id_fk", + "tableFrom": "job_verification_metric_measurement", + "tableTo": "job_verification_metric", + "columnsFrom": ["job_verification_metric_status_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_verification_metric": { + "name": "job_verification_metric", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "job_id": { + "name": "job_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "policy_rule_verification_metric_id": { + "name": "policy_rule_verification_metric_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "success_threshold": { + "name": "success_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_condition": { + "name": "failure_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "failure_threshold": { + "name": "failure_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + } + }, + "indexes": { + "job_verification_metric_job_id_index": { + "name": "job_verification_metric_job_id_index", + "columns": [ + { + "expression": "job_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "job_verification_metric_policy_rule_verification_metric_id_index": { + "name": "job_verification_metric_policy_rule_verification_metric_id_index", + "columns": [ + { + "expression": "policy_rule_verification_metric_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk": { + "name": "job_verification_metric_policy_rule_verification_metric_id_policy_rule_job_verification_metric_id_fk", + "tableFrom": "job_verification_metric", + "tableTo": "policy_rule_job_verification_metric", + "columnsFrom": ["policy_rule_verification_metric_id"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.policy_rule_job_verification_metric": { + "name": "policy_rule_job_verification_metric", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "trigger_on": { + "name": "trigger_on", + "type": "job_verification_trigger_on", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'jobSuccess'" + }, + "policy_id": { + "name": "policy_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "interval_seconds": { + "name": "interval_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_condition": { + "name": "success_condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "success_threshold": { + "name": "success_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "failure_condition": { + "name": "failure_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'false'" + }, + "failure_threshold": { + "name": "failure_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": { + "policy_rule_job_verification_metric_policy_id_policy_id_fk": { + "name": "policy_rule_job_verification_metric_policy_id_policy_id_fk", + "tableFrom": "policy_rule_job_verification_metric", + "tableTo": "policy", + "columnsFrom": ["policy_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.computed_entity_relationship": { + "name": "computed_entity_relationship", + "schema": "", + "columns": { + "rule_id": { + "name": "rule_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "from_entity_type": { + "name": "from_entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "from_entity_id": { + "name": "from_entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "to_entity_type": { + "name": "to_entity_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "to_entity_id": { + "name": "to_entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "last_evaluated_at": { + "name": "last_evaluated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "computed_entity_relationship_from_idx": { + "name": "computed_entity_relationship_from_idx", + "columns": [ + { + "expression": "from_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "from_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "computed_entity_relationship_to_idx": { + "name": "computed_entity_relationship_to_idx", + "columns": [ + { + "expression": "to_entity_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "to_entity_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "computed_entity_relationship_rule_id_relationship_rule_id_fk": { + "name": "computed_entity_relationship_rule_id_relationship_rule_id_fk", + "tableFrom": "computed_entity_relationship", + "tableTo": "relationship_rule", + "columnsFrom": ["rule_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk": { + "name": "computed_entity_relationship_rule_id_from_entity_type_from_entity_id_to_entity_type_to_entity_id_pk", + "columns": [ + "rule_id", + "from_entity_type", + "from_entity_id", + "to_entity_type", + "to_entity_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.relationship_rule": { + "name": "relationship_rule", + "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": true + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "cel": { + "name": "cel", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + } + }, + "indexes": { + "relationship_rule_workspace_id_reference_index": { + "name": "relationship_rule_workspace_id_reference_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "reference", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "relationship_rule_workspace_id_index": { + "name": "relationship_rule_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "relationship_rule_workspace_id_workspace_id_fk": { + "name": "relationship_rule_workspace_id_workspace_id_fk", + "tableFrom": "relationship_rule", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_agent": { + "name": "job_agent", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "config": { + "name": "config", + "type": "json", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + } + }, + "indexes": { + "job_agent_workspace_id_name_index": { + "name": "job_agent_workspace_id_name_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "job_agent_workspace_id_workspace_id_fk": { + "name": "job_agent_workspace_id_workspace_id_fk", + "tableFrom": "job_agent", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.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": true, + "default": "''" + }, + "selector": { + "name": "selector", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "metadata": { + "name": "metadata", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "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": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "variable_set_workspace_id_workspace_id_fk": { + "name": "variable_set_workspace_id_workspace_id_fk", + "tableFrom": "variable_set", + "tableTo": "workspace", + "columnsFrom": ["workspace_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.variable_set_variable": { + "name": "variable_set_variable", + "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": {}, + "foreignKeys": { + "variable_set_variable_variable_set_id_variable_set_id_fk": { + "name": "variable_set_variable_variable_set_id_variable_set_id_fk", + "tableFrom": "variable_set_variable", + "tableTo": "variable_set", + "columnsFrom": ["variable_set_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "variable_set_variable_variable_set_id_key_unique": { + "name": "variable_set_variable_variable_set_id_key_unique", + "nullsNotDistinct": false, + "columns": ["variable_set_id", "key"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.system_role": { + "name": "system_role", + "schema": "public", + "values": ["user", "admin"] + }, + "public.deployment_plan_target_status": { + "name": "deployment_plan_target_status", + "schema": "public", + "values": ["computing", "completed", "errored", "unsupported"] + }, + "public.deployment_version_status": { + "name": "deployment_version_status", + "schema": "public", + "values": [ + "unspecified", + "building", + "ready", + "failed", + "rejected", + "paused" + ] + }, + "public.job_reason": { + "name": "job_reason", + "schema": "public", + "values": [ + "policy_passing", + "policy_override", + "env_policy_override", + "config_policy_override", + "redeploy" + ] + }, + "public.job_status": { + "name": "job_status", + "schema": "public", + "values": [ + "cancelled", + "skipped", + "in_progress", + "action_required", + "pending", + "failure", + "invalid_job_agent", + "invalid_integration", + "external_run_not_found", + "successful" + ] + }, + "public.entity_type": { + "name": "entity_type", + "schema": "public", + "values": ["user", "team"] + }, + "public.scope_type": { + "name": "scope_type", + "schema": "public", + "values": [ + "deploymentVersion", + "resource", + "resourceProvider", + "workspace", + "environment", + "system", + "deployment" + ] + }, + "public.job_verification_status": { + "name": "job_verification_status", + "schema": "public", + "values": ["failed", "inconclusive", "passed"] + }, + "public.job_verification_trigger_on": { + "name": "job_verification_trigger_on", + "schema": "public", + "values": ["jobCreated", "jobStarted", "jobSuccess", "jobFailure"] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index 645dbf192..72637228d 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -1282,6 +1282,13 @@ "when": 1775163434949, "tag": "0182_rainy_changeling", "breakpoints": true + }, + { + "idx": 183, + "version": "7", + "when": 1775498241826, + "tag": "0183_even_layla_miller", + "breakpoints": true } ] } From 68e6a8e255f9dc9962b5d0c14a0d13e84f435de3 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Mon, 6 Apr 2026 11:16:40 -0700 Subject: [PATCH 10/10] duplicate key checking --- .../src/routes/v1/workspaces/variable-sets.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/api/src/routes/v1/workspaces/variable-sets.ts b/apps/api/src/routes/v1/workspaces/variable-sets.ts index 96692c8ad..6a34ccc31 100644 --- a/apps/api/src/routes/v1/workspaces/variable-sets.ts +++ b/apps/api/src/routes/v1/workspaces/variable-sets.ts @@ -1,5 +1,5 @@ import type { AsyncTypedHandler } from "@/types/api.js"; -import { asyncHandler, NotFoundError } from "@/types/api.js"; +import { asyncHandler, BadRequestError, NotFoundError } from "@/types/api.js"; import { Router } from "express"; import { @@ -61,6 +61,13 @@ const createVariableSet: AsyncTypedHandler< const { workspaceId } = req.params; const { variables = [], ...setData } = req.body; + const keys = variables.map((v) => v.key); + const duplicateKeys = keys.filter((k, i) => keys.indexOf(k) !== i); + if (duplicateKeys.length > 0) + throw new BadRequestError( + `Duplicate variable keys: ${[...new Set(duplicateKeys)].join(", ")}`, + ); + const created = await db.transaction(async (tx) => { const vs = await tx .insert(schema.variableSet) @@ -116,6 +123,15 @@ const updateVariableSet: AsyncTypedHandler< const { variableSetId, workspaceId } = req.params; const { variables, ...setData } = req.body; + if (variables != null) { + const keys = variables.map((v) => v.key); + const duplicateKeys = keys.filter((k, i) => keys.indexOf(k) !== i); + if (duplicateKeys.length > 0) + throw new BadRequestError( + `Duplicate variable keys: ${[...new Set(duplicateKeys)].join(", ")}`, + ); + } + const updated = await db.transaction(async (tx) => { const vs = await tx .update(schema.variableSet)