diff --git a/apps/docs/content/docs/(guide)/index.mdx b/apps/docs/content/docs/(guide)/index.mdx index be9429ab..486198c6 100644 --- a/apps/docs/content/docs/(guide)/index.mdx +++ b/apps/docs/content/docs/(guide)/index.mdx @@ -12,11 +12,11 @@ Clowder is a self-hosted PaaS (Platform as a Service) inspired by [Railway](http I wasn't happy with any self-hosted PaaS. I wanted a simple UI that I can count on (Railway was on point). I found Uncloud but it didn't have a webui from where I could manage it, so I built Clowder, which uses a canvas, like Railway. -"Why not just use Railway?" It can get way too expensive. For example my setup would cost over $500/mo to run on Railway but I only pay ~$40 to [BelgiumVM](https://belgiumvm.be) and also get much better performance, security and control. +"Why not just use Railway?" It can get very expensive. For example my setup would cost way over $500/mo to run on Railway but I only pay ~$40 to [BelgiumVM](https://irazz.click/belgiumvm) and also get much better performance, security and control. ## Human written -These docs are fully written by [me](https://github.com/iRazvan2745). If you find any mistakes please make an [issue](https://github.com/clowder-run/clowder/issues) +These docs are fully written by [me](https://github.com/iRazvan2745). If you find any mistakes please make an [issue](https://github.com/clowder-run/clowder/issues). ## What's next? diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json index 126422e7..c9c314d3 100644 --- a/apps/docs/openapi.json +++ b/apps/docs/openapi.json @@ -6665,6 +6665,276 @@ } } }, + "/notifications/list": { + "post": { + "operationId": "notifications.list", + "responses": { + "200": { + "description": "OK", + "content": {} + } + } + } + }, + "/notifications/create": { + "post": { + "operationId": "notifications.create", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 100 + }, + "events": { + "type": "array", + "items": { + "enum": [ + "deployment.succeeded", + "deployment.failed" + ], + "type": "string" + }, + "minItems": 1, + "maxItems": 2 + }, + "config": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "const": "discord" + }, + "webhookUrl": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "pattern": "^https:\\/\\/(?:(?:canary|ptb)\\.)?discord(?:app)?\\.com\\/api\\/webhooks\\/\\d+\\/[\\w-]+(?:\\?[^\\s#]*)?$" + } + }, + "required": [ + "type", + "webhookUrl" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "telegram" + }, + "botToken": { + "type": "string", + "minLength": 1, + "maxLength": 256, + "pattern": "^\\d+:[\\w-]+$" + }, + "chatId": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^(?:-?\\d+|@\\w{5,})$" + } + }, + "required": [ + "type", + "botToken", + "chatId" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "ntfy" + }, + "serverUrl": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "format": "uri", + "pattern": "^https?:\\/\\/" + }, + "topic": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "pattern": "^[\\w-]+$" + }, + "token": { + "type": "string", + "minLength": 1, + "maxLength": 256 + } + }, + "required": [ + "type", + "serverUrl", + "topic" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "gchat" + }, + "webhookUrl": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "pattern": "^https:\\/\\/chat\\.googleapis\\.com\\/v1\\/spaces\\/[^/\\s]+\\/messages\\?\\S+$" + } + }, + "required": [ + "type", + "webhookUrl" + ] + }, + { + "type": "object", + "properties": { + "type": { + "const": "webhook" + }, + "url": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "format": "uri", + "pattern": "^https?:\\/\\/" + }, + "secret": { + "type": "string", + "minLength": 1, + "maxLength": 256 + } + }, + "required": [ + "type", + "url" + ] + } + ] + } + }, + "required": [ + "name", + "events", + "config" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": {} + } + } + } + }, + "/notifications/setEnabled": { + "post": { + "operationId": "notifications.setEnabled", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "channelId": { + "type": "string", + "format": "uuid" + }, + "enabled": { + "type": "boolean" + } + }, + "required": [ + "channelId", + "enabled" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": {} + } + } + } + }, + "/notifications/remove": { + "post": { + "operationId": "notifications.remove", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "channelId": { + "type": "string", + "format": "uuid" + } + }, + "required": [ + "channelId" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": {} + } + } + } + }, + "/notifications/test": { + "post": { + "operationId": "notifications.test", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "channelId": { + "type": "string", + "format": "uuid" + } + }, + "required": [ + "channelId" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": {} + } + } + } + }, "/terminal/open": { "post": { "operationId": "terminal.open", diff --git a/apps/docs/src/components/docs.tsx b/apps/docs/src/components/docs.tsx index 18ed81b8..9e8aba4f 100644 --- a/apps/docs/src/components/docs.tsx +++ b/apps/docs/src/components/docs.tsx @@ -42,12 +42,12 @@ export function Docs({ -
+
{title} {description}
-
+
diff --git a/apps/web/src/lib/components/settings/organization-notifications.svelte b/apps/web/src/lib/components/settings/organization-notifications.svelte new file mode 100644 index 00000000..17994728 --- /dev/null +++ b/apps/web/src/lib/components/settings/organization-notifications.svelte @@ -0,0 +1,646 @@ + + + + {#snippet actions()} + + {/snippet} + {#if channelsQuery.isError} + + + {channelsQuery.error.message} + + + {:else if channelsQuery.isSuccess && channelsQuery.data.length === 0} + + + + + No notification channels yet + + + {:else} + + + {#if channelsQuery.isPending} + +
+ + + Deployments channel + +
+
+ {:else} +
    + {#each channelsQuery.data as channel, index (channel.id)} + {@const Icon = + channelTypes[channel.type].icon} +
  • + {#if index > 0}{/if} +
    + + +
    +

    + + {channel.name} + + {#if !channel.enabled} + + Paused + + {/if} +

    +

    + {channelTypes[ + channel.type + ].label} · {eventSummary( + channel.events, + )} +

    +
    + + + + + + testState.mutate({ + channelId: + channel.id, + })} + > + + + enabledState.mutate( + { + channelId: + channel.id, + enabled: + !channel.enabled, + }, + )} + > + {#if channel.enabled} + + + askRemove( + channel.id, + )} + > + + + +
    +
  • + {/each} +
+ {/if} +
+
+ {/if} +
+ + + + + Add notification channel + + Clowder sends a test message once it's added. + + + + {#if createState.isError} + + + {createState.error.message} + + + {/if} +
+ + + + + + + + + {#each fields as field (`${type}:${field.key}`)} + + + + {#if field.hint} + + {field.hint} + + {/if} + + {/each} +
+ + Notify when + + {#each eventOptions as option (option.value)} + + {/each} +
+
+
+ + + +
+
+ + removeState.mutate({ channelId: removeId })} +/> diff --git a/apps/web/src/lib/components/settings/organization-sandbox-images.svelte b/apps/web/src/lib/components/settings/organization-sandbox-images.svelte index 1c8b8afa..22ee3f74 100644 --- a/apps/web/src/lib/components/settings/organization-sandbox-images.svelte +++ b/apps/web/src/lib/components/settings/organization-sandbox-images.svelte @@ -116,7 +116,7 @@ {/snippet} + {#if imagesQuery.isError} diff --git a/apps/web/src/lib/components/settings/settings-section.svelte b/apps/web/src/lib/components/settings/settings-section.svelte index 9e07b264..86fb9359 100644 --- a/apps/web/src/lib/components/settings/settings-section.svelte +++ b/apps/web/src/lib/components/settings/settings-section.svelte @@ -20,9 +20,9 @@
-
+

{:else if active === "sandbox-images"} + {:else if active === "notifications"} + {:else if active === "api-keys"} {:else if active === "danger"} diff --git a/packages/api/src/git/index.ts b/packages/api/src/git/index.ts index ae49196d..e0c9d47d 100644 --- a/packages/api/src/git/index.ts +++ b/packages/api/src/git/index.ts @@ -8,8 +8,11 @@ import { tmpdir } from "node:os"; import { join, posix } from "node:path"; import { ORPCError } from "@orpc/server"; +import { isBlockedAddress } from "@clowder/workflows/blocked-address"; import * as v from "valibot"; +export { isBlockedAddress }; + export type GitCredentials = { username?: string; password?: string; @@ -38,40 +41,6 @@ function invalid(message: string): never { throw new ORPCError("BAD_REQUEST", { message }); } -// Private networks (RFC1918, IPv6 ULA) are allowed: Git servers often live on the LAN. -// Loopback, link-local, cloud metadata, transition and special-use ranges never are. -export function isBlockedAddress(address: string): boolean { - if (isIP(address) === 4) { - const [a = 0, b = 0, c = 0] = address.split(".").map(Number); - - return ( - address === "168.63.129.16" || // Azure platform/metadata services. - a === 0 || - a === 127 || - a >= 224 || - (a === 100 && b >= 64 && b <= 127) || - (a === 169 && b === 254) || - (a === 192 && ((b === 0 && (c === 0 || c === 2)) || (b === 88 && c === 99))) || - (a === 198 && (b === 18 || b === 19 || (b === 51 && c === 100))) || - (a === 203 && b === 0 && c === 113) - ); - } - - if (isIP(address) !== 6) return true; - const normalized = new URL(`https://[${address}]/`).hostname.slice(1, -1); - const first = Number.parseInt(normalized.split(":")[0] || "0", 16); - - if (normalized === "fd00:ec2::254" || normalized === "fd20:ce::254") return true; - - if ((first & 0xfe00) === 0xfc00) return false; - - // Only global unicast; exclude mapped IPv4, NAT64, Teredo, 6to4 and documentation ranges. - if (first < 0x2000 || first > 0x3fff || first === 0x2002 || first === 0x3fff) return true; - const second = Number.parseInt(normalized.split(":")[1] || "0", 16); - - return first === 0x2001 && (second < 0x200 || second === 0xdb8); -} - function checkHost(host: string) { if ( host === "localhost" || diff --git a/packages/api/src/routers/index.ts b/packages/api/src/routers/index.ts index 4d1e5cc2..9cbc5f56 100644 --- a/packages/api/src/routers/index.ts +++ b/packages/api/src/routers/index.ts @@ -12,6 +12,7 @@ import { s3Router } from "./s3"; import { sandboxesRouter } from "./sandboxes"; import { terminalRouter } from "./terminal"; import { volumesRouter } from "./volumes"; +import { notificationsRouter } from "./notifications"; const healthCheck = publicProcedure.handler(() => { return "OK"; @@ -27,6 +28,7 @@ export type AppRouter = { buckets: typeof bucketsRouter; sandboxes: typeof sandboxesRouter; volumes: typeof volumesRouter; + notifications: typeof notificationsRouter; terminal: typeof terminalRouter; healthCheck: typeof healthCheck; }; @@ -40,6 +42,7 @@ export const appRouter: AppRouter = { buckets: bucketsRouter, sandboxes: sandboxesRouter, volumes: volumesRouter, + notifications: notificationsRouter, terminal: terminalRouter, healthCheck, }; diff --git a/packages/api/src/routers/notifications.ts b/packages/api/src/routers/notifications.ts new file mode 100644 index 00000000..f4d332a0 --- /dev/null +++ b/packages/api/src/routers/notifications.ts @@ -0,0 +1,172 @@ +import { ORPCError } from "@orpc/server"; +import { notificationChannels } from "@clowder/db/schema/index"; +import { testNotice } from "@clowder/workflows/notifications/notice"; +import { readChannelConfig, sendNotice } from "@clowder/workflows/notifications/send"; +import { and, asc, eq } from "drizzle-orm"; +import { randomUUID } from "node:crypto"; +import * as v from "valibot"; + +import { organizationProcedure } from ".."; + +const id = v.pipe(v.string(), v.uuid()); + +const text = (max: number) => v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(max)); + +const httpUrl = v.pipe( + text(2048), + v.url("Enter a full URL."), + v.regex(/^https?:\/\//iu, "Use an http or https URL."), +); + +// Fixed hosts are checked here; user-chosen hosts are checked when the request connects. +const config = v.variant("type", [ + v.object({ + type: v.literal("discord"), + webhookUrl: v.pipe( + text(2048), + v.regex( + /^https:\/\/(?:(?:canary|ptb)\.)?discord(?:app)?\.com\/api\/webhooks\/\d+\/[\w-]+(?:\?[^\s#]*)?$/u, + "Enter a Discord webhook URL.", + ), + ), + }), + v.object({ + type: v.literal("telegram"), + botToken: v.pipe(text(256), v.regex(/^\d+:[\w-]+$/u, "Enter the token from @BotFather.")), + chatId: v.pipe( + text(64), + v.regex(/^(?:-?\d+|@\w{5,})$/u, "Enter a numeric chat ID or @channelname."), + ), + }), + v.object({ + type: v.literal("ntfy"), + serverUrl: httpUrl, + topic: v.pipe( + text(64), + v.regex(/^[\w-]+$/u, "Topics are letters, numbers, dashes and underscores."), + ), + token: v.optional(text(256)), + }), + v.object({ + type: v.literal("gchat"), + webhookUrl: v.pipe( + text(2048), + v.regex( + /^https:\/\/chat\.googleapis\.com\/v1\/spaces\/[^/\s]+\/messages\?\S+$/u, + "Enter a Google Chat webhook URL.", + ), + ), + }), + v.object({ type: v.literal("webhook"), url: httpUrl, secret: v.optional(text(256)) }), +]); + +const events = v.pipe( + v.array(v.picklist(["deployment.succeeded", "deployment.failed"])), + v.minLength(1, "Pick at least one event."), + v.maxLength(2), +); + +const channelColumns = { + id: notificationChannels.id, + name: notificationChannels.name, + type: notificationChannels.type, + events: notificationChannels.events, + enabled: notificationChannels.enabled, +}; + +function notFound() { + return new ORPCError("NOT_FOUND", { message: "Notification channel not found." }); +} + +export const notificationsRouter = { + // Never returns the destination: webhook URLs and tokens are credentials. + list: organizationProcedure.handler(({ context: { db, organizationId } }) => + db + .select(channelColumns) + .from(notificationChannels) + .where(eq(notificationChannels.organizationId, organizationId)) + .orderBy(asc(notificationChannels.name)), + ), + create: organizationProcedure + .input(v.object({ name: text(100), events, config })) + .handler(async ({ context: { db, organizationId }, input }) => { + const [created] = await db + .insert(notificationChannels) + .values({ + id: randomUUID(), + organizationId, + name: input.name, + type: input.config.type, + config: JSON.stringify(input.config), + events: [...new Set(input.events)], + }) + .returning(channelColumns); + + return created!; + }), + setEnabled: organizationProcedure + .input(v.object({ channelId: id, enabled: v.boolean() })) + .handler(async ({ context: { db, organizationId }, input }) => { + const [updated] = await db + .update(notificationChannels) + .set({ enabled: input.enabled }) + .where( + and( + eq(notificationChannels.id, input.channelId), + eq(notificationChannels.organizationId, organizationId), + ), + ) + .returning(channelColumns); + + if (!updated) throw notFound(); + + return updated; + }), + remove: organizationProcedure + .input(v.object({ channelId: id })) + .handler(async ({ context: { db, organizationId }, input }) => { + const [removed] = await db + .delete(notificationChannels) + .where( + and( + eq(notificationChannels.id, input.channelId), + eq(notificationChannels.organizationId, organizationId), + ), + ) + .returning({ id: notificationChannels.id }); + + if (!removed) throw notFound(); + + return removed; + }), + // Sends right away, so the dialog can show whether the destination works. + test: organizationProcedure + .input(v.object({ channelId: id })) + .handler(async ({ context: { db, organizationId }, input, signal }) => { + const [channel] = await db + .select({ name: notificationChannels.name, config: notificationChannels.config }) + .from(notificationChannels) + .where( + and( + eq(notificationChannels.id, input.channelId), + eq(notificationChannels.organizationId, organizationId), + ), + ) + .limit(1); + + if (!channel) throw notFound(); + + try { + await sendNotice( + readChannelConfig(channel.config), + channel.name, + testNotice(channel.name), + signal, + ); + } catch (error) { + throw new ORPCError("BAD_GATEWAY", { + message: `Sending failed: ${error instanceof Error ? error.message : "unknown error"}`, + }); + } + }), +}; diff --git a/packages/db/src/migrations/20261123203854_notification_channels/migration.sql b/packages/db/src/migrations/20261123203854_notification_channels/migration.sql new file mode 100644 index 00000000..37c4a6d7 --- /dev/null +++ b/packages/db/src/migrations/20261123203854_notification_channels/migration.sql @@ -0,0 +1,15 @@ +CREATE TABLE "notification_channels" ( + "id" uuid PRIMARY KEY, + "organization_id" text NOT NULL, + "name" text NOT NULL, + "type" text NOT NULL, + "config" text NOT NULL, + "events" jsonb NOT NULL, + "enabled" boolean DEFAULT true NOT NULL, + "created_at" timestamp with time zone NOT NULL, + "updated_at" timestamp with time zone NOT NULL, + CONSTRAINT "notification_channels_type_check" CHECK ("type" in ('discord', 'telegram', 'ntfy', 'gchat', 'webhook')) +); +--> statement-breakpoint +CREATE INDEX "notification_channels_organization_idx" ON "notification_channels" ("organization_id");--> statement-breakpoint +ALTER TABLE "notification_channels" ADD CONSTRAINT "notification_channels_organization_id_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "organization"("id") ON DELETE CASCADE; \ No newline at end of file diff --git a/packages/db/src/migrations/20261123203854_notification_channels/snapshot.json b/packages/db/src/migrations/20261123203854_notification_channels/snapshot.json new file mode 100644 index 00000000..9df2e27c --- /dev/null +++ b/packages/db/src/migrations/20261123203854_notification_channels/snapshot.json @@ -0,0 +1,6267 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "740281bd-662f-4567-8d16-4cb826b32cc2", + "prevIds": ["fa4d015f-f60f-4fc5-a429-9cbba675e94b"], + "ddl": [ + { + "isRlsEnabled": false, + "name": "cluster_monitoring", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "clusters", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "deployment_logs", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "deployments", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "git_connections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "git_oauth_providers", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "instance_settings", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "notification_channels", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_favorites", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "projects", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resource_deployment_inputs", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resource_groups", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resources", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "s3_buckets", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "s3_connections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "sandbox_images", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "sandboxes", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_settings", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "volumes", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "apikey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "invitation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "member", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_job_attempts", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_dedupe", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_flow_children", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_flow_outbox", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_queue_control", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_schedules", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_jobs", + "entityType": "tables", + "schema": "public" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_password", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "template_version", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_url", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_token", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_certificate", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provisioning", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provisioning_secrets", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_machine", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_machine_key", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "greptime_url", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "caddy_resource_id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialised_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_requested_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'uninitialized'", + "generated": null, + "identity": null, + "name": "initialization_status", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_error", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_configuration", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "bigserial", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deployment_id", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'build'", + "generated": null, + "identity": null, + "name": "stream", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "text", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'queued'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "configuration", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "smallint", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "progress", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "server_url", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'token'", + "generated": null, + "identity": null, + "name": "auth_type", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'[]'", + "generated": null, + "identity": null, + "name": "repositories", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "server_url", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "client_id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_client_secret", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "active", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "1", + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "instance_settings" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "signups_enabled", + "entityType": "columns", + "schema": "public", + "table": "instance_settings" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "events", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "project_favorites" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_favorites" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "is_internal", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "canvas_layout", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deployment_id", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prefix", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "''", + "generated": null, + "identity": null, + "name": "env", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "recreate", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "config_files", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "icon", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "icon", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "'compose'", + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "draft_spec", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "draft_config_files", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "pending_delete", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "settings", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "git_connection_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "git_source", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "group_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "connection_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "quota", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "endpoint", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'us-east-1'", + "generated": null, + "identity": null, + "name": "region", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "force_path_style", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_account_id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_api_token", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_tested_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_test_status", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_test_error", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "1", + "generated": null, + "identity": null, + "name": "version", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "machine", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ssh_port", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ssh_host", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "volume_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'provisioning'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "external_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "authorized_keys", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ttl_seconds", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_settings" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "canvas_mode", + "entityType": "columns", + "schema": "public", + "table": "user_settings" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "machine", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'default'", + "generated": null, + "identity": null, + "name": "config_id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "start", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reference_id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prefix", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refill_interval", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refill_amount", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_refill_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "rate_limit_enabled", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rate_limit_time_window", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rate_limit_max", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "remaining", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_request", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "permissions", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'pending'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "inviter_id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'member'", + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "logo", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "active_organization_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "impersonated_by", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "banned", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ban_reason", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ban_expires", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempt", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "outcome", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "started_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "window_expires_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "child_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "store_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "failed_reason", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cascaded", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_since", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "bigserial", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "parent_store_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "report", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_queue_control" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "paused", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_queue_control" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cron", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tz", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "every_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "payload", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempts_max", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backoff", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "keep", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "timeout_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "group_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "next_run_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "state", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": { + "type": "byDefault", + "name": "effect_mq_jobs_seq_seq", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": 1, + "cycle": false + }, + "name": "seq", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "payload", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempts_max", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "attempts_made", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "stalled_count", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backoff", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "keep", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "timeout_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "cancel_requested", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dedupe_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "parent", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_fail_fast", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_pending", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_completed", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_failed", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_cancelled", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "run_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "enqueued_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "failed_reason", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "lock_token", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "lock_expires_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "clusters_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "deployment_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployment_logs_deployment_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployment_logs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "cluster_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_cluster_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_resource_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "name", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'queued'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_queued_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "git_connections_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "git_connections" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "git_oauth_providers_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "notification_channels_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "notification_channels" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_favorites_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "cluster_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "projects_cluster_idx", + "entityType": "indexes", + "schema": "public", + "table": "projects" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resource_groups_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "resource_groups" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "group_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_group_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "git_connection_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_git_connection_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "slug", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_slug_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "s3_connections_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "account_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_providerId_accountId_uidx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "config_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_configId_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "reference_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_referenceId_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "key", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_key_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "invitation_organizationId_idx", + "entityType": "indexes", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "email", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "invitation_email_idx", + "entityType": "indexes", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "member_organizationId_idx", + "entityType": "indexes", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "member_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "slug", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_slug_uidx", + "entityType": "indexes", + "schema": "public", + "table": "organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "identifier", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "verification_identifier_idx", + "entityType": "indexes", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "pending_since", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'pending'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_flow_children_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "flow_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'cancelled' AND NOT \"cascaded\"", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_flow_children_cascade_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "next_run_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_schedules_due_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "queue", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "priority", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + }, + { + "value": "seq", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'waiting'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_ready_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "queue", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "run_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'delayed'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_delayed_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "lock_expires_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'active'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_active_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "name", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "state", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "finished_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_history_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "enqueued_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_listing_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "metadata", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": { + "name": "jsonb_path_ops", + "default": false + } + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "gin", + "concurrently": false, + "name": "effect_mq_jobs_metadata_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["caddy_resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "clusters_caddy_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "clusters_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": false, + "columns": ["deployment_id"], + "schemaTo": "public", + "tableTo": "deployments", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployment_logs_deployment_id_deployments_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployment_logs" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployments_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployments_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "git_connections_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "git_connections" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "git_oauth_providers_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "notification_channels_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "notification_channels" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_favorites_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_favorites_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "projects_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "projects" + }, + { + "nameExplicit": false, + "columns": ["deployment_id"], + "schemaTo": "public", + "tableTo": "deployments", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resource_deployment_inputs_deployment_id_deployments_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resource_groups_project_id_projects_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "resource_groups" + }, + { + "nameExplicit": false, + "columns": ["git_connection_id"], + "schemaTo": "public", + "tableTo": "git_connections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "resources_git_connection_id_git_connections_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resources_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["group_id"], + "schemaTo": "public", + "tableTo": "resource_groups", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "resources_group_id_resource_groups_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "s3_buckets_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": false, + "columns": ["connection_id"], + "schemaTo": "public", + "tableTo": "s3_connections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "s3_buckets_connection_id_s3_connections_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "s3_connections_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandbox_images_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandbox_images" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_cluster_id_clusters_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["volume_id"], + "schemaTo": "public", + "tableTo": "volumes", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "sandboxes_volume_id_volumes_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_settings_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_settings" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "volumes_cluster_id_clusters_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "volumes_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": ["reference_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "apikey_reference_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "invitation_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": false, + "columns": ["inviter_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "invitation_inviter_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "member_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "member_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": ["job_id"], + "schemaTo": "public", + "tableTo": "effect_mq_jobs", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "effect_mq_job_attempts_job_id_effect_mq_jobs_id_fk", + "entityType": "fks", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "columns": ["user_id", "project_id"], + "nameExplicit": false, + "name": "project_favorites_user_id_project_id_pk", + "entityType": "pks", + "schema": "public", + "table": "project_favorites" + }, + { + "columns": ["job_id", "attempt"], + "nameExplicit": false, + "name": "effect_mq_job_attempts_job_id_attempt_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "columns": ["name", "key"], + "nameExplicit": false, + "name": "effect_mq_dedupe_name_key_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "columns": ["flow_id", "child_key"], + "nameExplicit": false, + "name": "effect_mq_flow_children_flow_id_child_key_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "columns": ["cluster_id"], + "nameExplicit": false, + "name": "cluster_monitoring_pkey", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "clusters_pkey", + "schema": "public", + "table": "clusters", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "deployment_logs_pkey", + "schema": "public", + "table": "deployment_logs", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "deployments_pkey", + "schema": "public", + "table": "deployments", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "git_connections_pkey", + "schema": "public", + "table": "git_connections", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "git_oauth_providers_pkey", + "schema": "public", + "table": "git_oauth_providers", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "instance_settings_pkey", + "schema": "public", + "table": "instance_settings", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "notification_channels_pkey", + "schema": "public", + "table": "notification_channels", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "projects_pkey", + "schema": "public", + "table": "projects", + "entityType": "pks" + }, + { + "columns": ["deployment_id"], + "nameExplicit": false, + "name": "resource_deployment_inputs_pkey", + "schema": "public", + "table": "resource_deployment_inputs", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "resource_groups_pkey", + "schema": "public", + "table": "resource_groups", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "resources_pkey", + "schema": "public", + "table": "resources", + "entityType": "pks" + }, + { + "columns": ["resource_id"], + "nameExplicit": false, + "name": "s3_buckets_pkey", + "schema": "public", + "table": "s3_buckets", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "s3_connections_pkey", + "schema": "public", + "table": "s3_connections", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "sandbox_images_pkey", + "schema": "public", + "table": "sandbox_images", + "entityType": "pks" + }, + { + "columns": ["resource_id"], + "nameExplicit": false, + "name": "sandboxes_pkey", + "schema": "public", + "table": "sandboxes", + "entityType": "pks" + }, + { + "columns": ["user_id"], + "nameExplicit": false, + "name": "user_settings_pkey", + "schema": "public", + "table": "user_settings", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "volumes_pkey", + "schema": "public", + "table": "volumes", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "apikey_pkey", + "schema": "public", + "table": "apikey", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "invitation_pkey", + "schema": "public", + "table": "invitation", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "member_pkey", + "schema": "public", + "table": "member", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "effect_mq_flow_outbox_pkey", + "schema": "public", + "table": "effect_mq_flow_outbox", + "entityType": "pks" + }, + { + "columns": ["queue"], + "nameExplicit": false, + "name": "effect_mq_queue_control_pkey", + "schema": "public", + "table": "effect_mq_queue_control", + "entityType": "pks" + }, + { + "columns": ["key"], + "nameExplicit": false, + "name": "effect_mq_schedules_pkey", + "schema": "public", + "table": "effect_mq_schedules", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "effect_mq_jobs_pkey", + "schema": "public", + "table": "effect_mq_jobs", + "entityType": "pks" + }, + { + "nameExplicit": true, + "columns": ["connection_id", "name"], + "nullsNotDistinct": false, + "name": "s3_buckets_connection_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "name"], + "nullsNotDistinct": false, + "name": "s3_connections_organization_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "provider", "image"], + "nullsNotDistinct": false, + "name": "sandbox_images_organization_image_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandbox_images" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "slug"], + "nullsNotDistinct": false, + "name": "sandboxes_organization_slug_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["cluster_id", "ssh_port"], + "nullsNotDistinct": false, + "name": "sandboxes_cluster_ssh_port_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["volume_id"], + "nullsNotDistinct": false, + "name": "sandboxes_volume_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["cluster_id", "name"], + "nullsNotDistinct": false, + "name": "volumes_cluster_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "nullsNotDistinct": false, + "name": "cluster_monitoring_project_id_unique", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "nullsNotDistinct": false, + "name": "cluster_monitoring_resource_id_unique", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["job_id"], + "nullsNotDistinct": false, + "name": "deployments_job_id_unique", + "schema": "public", + "table": "deployments", + "entityType": "uniques" + }, + { + "nameExplicit": true, + "columns": ["resource_id"], + "nullsNotDistinct": false, + "name": "volumes_resource_uidx", + "schema": "public", + "table": "volumes", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["slug"], + "nullsNotDistinct": false, + "name": "organization_slug_unique", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["token"], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["email"], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + }, + { + "value": "\"id\" = 1", + "name": "instance_settings_singleton", + "entityType": "checks", + "schema": "public", + "table": "instance_settings" + }, + { + "value": "\"type\" in ('discord', 'telegram', 'ntfy', 'gchat', 'webhook')", + "name": "notification_channels_type_check", + "entityType": "checks", + "schema": "public", + "table": "notification_channels" + }, + { + "value": "\"status\" in ('provisioning', 'ready', 'failed', 'deleting')", + "name": "s3_buckets_status_check", + "entityType": "checks", + "schema": "public", + "table": "s3_buckets" + }, + { + "value": "\"provider\" in ('generic', 'rustfs', 'r2')", + "name": "s3_connections_provider_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "(\"provider\" = 'r2') = (\n \"provider_account_id\" is not null and \"encrypted_api_token\" is not null\n )", + "name": "s3_connections_provider_account_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "\"last_test_status\" in ('success', 'failure') or \"last_test_status\" is null", + "name": "s3_connections_test_status_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "\"provider\" in ('uncloud')", + "name": "sandbox_images_provider_check", + "entityType": "checks", + "schema": "public", + "table": "sandbox_images" + }, + { + "value": "\"provider\" in ('uncloud')", + "name": "sandboxes_provider_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"status\" in ('provisioning', 'running', 'failed', 'destroying')", + "name": "sandboxes_status_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"ttl_seconds\" is null or \"ttl_seconds\" > 0", + "name": "sandboxes_ttl_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"slug\" ~ '^[a-z0-9]([-a-z0-9]*[a-z0-9])?$' and length(\"slug\") <= 55", + "name": "sandboxes_slug_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "(\"provider\" = 'uncloud') = (\"cluster_id\" is not null and \"ssh_port\" is not null)", + "name": "sandboxes_cluster_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"ssh_port\" is null or \"ssh_port\" between 1 and 65535", + "name": "sandboxes_ssh_port_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + } + ], + "renames": [] +} diff --git a/packages/db/src/migrations/20261123224944_glorious_korg/migration.sql b/packages/db/src/migrations/20261123224944_glorious_korg/migration.sql new file mode 100644 index 00000000..72c927a2 --- /dev/null +++ b/packages/db/src/migrations/20261123224944_glorious_korg/migration.sql @@ -0,0 +1 @@ +ALTER TABLE "sandbox_images" ADD COLUMN "name" text; \ No newline at end of file diff --git a/packages/db/src/migrations/20261123224944_glorious_korg/snapshot.json b/packages/db/src/migrations/20261123224944_glorious_korg/snapshot.json new file mode 100644 index 00000000..09b07eb0 --- /dev/null +++ b/packages/db/src/migrations/20261123224944_glorious_korg/snapshot.json @@ -0,0 +1,6280 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "9607dc99-202b-4221-8148-4ad8c0e4c68e", + "prevIds": ["740281bd-662f-4567-8d16-4cb826b32cc2"], + "ddl": [ + { + "isRlsEnabled": false, + "name": "cluster_monitoring", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "clusters", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "deployment_logs", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "deployments", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "git_connections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "git_oauth_providers", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "instance_settings", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "notification_channels", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "project_favorites", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "projects", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resource_deployment_inputs", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resource_groups", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resources", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "s3_buckets", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "s3_connections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "sandbox_images", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "sandboxes", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user_settings", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "volumes", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "account", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "apikey", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "invitation", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "member", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "organization", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "session", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "user", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "verification", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_job_attempts", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_dedupe", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_flow_children", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_flow_outbox", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_queue_control", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_schedules", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "effect_mq_jobs", + "entityType": "tables", + "schema": "public" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_password", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "template_version", + "entityType": "columns", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_url", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_token", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "sidecar_certificate", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provisioning", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provisioning_secrets", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_machine", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_machine_key", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "greptime_url", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "caddy_resource_id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialised_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_requested_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'uninitialized'", + "generated": null, + "identity": null, + "name": "initialization_status", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_error", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "initialization_configuration", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "clusters" + }, + { + "type": "bigserial", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deployment_id", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'build'", + "generated": null, + "identity": null, + "name": "stream", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "text", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "deployment_logs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'queued'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "configuration", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "smallint", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "progress", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "deployments" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "server_url", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'token'", + "generated": null, + "identity": null, + "name": "auth_type", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'[]'", + "generated": null, + "identity": null, + "name": "repositories", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "git_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "server_url", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "client_id", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_client_secret", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "active", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "1", + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "instance_settings" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "signups_enabled", + "entityType": "columns", + "schema": "public", + "table": "instance_settings" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "config", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "events", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "notification_channels" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "project_favorites" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "project_favorites" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "is_internal", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "canvas_layout", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "projects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deployment_id", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prefix", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "''", + "generated": null, + "identity": null, + "name": "env", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "recreate", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "config_files", + "entityType": "columns", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "icon", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "resource_groups" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "description", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "icon", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "'compose'", + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "draft_spec", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "draft_config_files", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "pending_delete", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "settings", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "git_connection_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "git_source", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "project_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "group_id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "connection_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "requested_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key_id", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "quota", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "s3_buckets" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "endpoint", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'us-east-1'", + "generated": null, + "identity": null, + "name": "region", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "force_path_style", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_credentials", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_account_id", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "encrypted_api_token", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_tested_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_test_status", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_test_error", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "1", + "generated": null, + "identity": null, + "name": "version", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "s3_connections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "sandbox_images" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "machine", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ssh_port", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ssh_host", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "volume_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'provisioning'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "external_id", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "authorized_keys", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ttl_seconds", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "sandboxes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "user_settings" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "canvas_mode", + "entityType": "columns", + "schema": "public", + "table": "user_settings" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cluster_id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "machine", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "resource_id", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "volumes" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "provider_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id_token", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "access_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refresh_token_expires_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "scope", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "password", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "account" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'default'", + "generated": null, + "identity": null, + "name": "config_id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "start", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "reference_id", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "prefix", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refill_interval", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "refill_amount", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_refill_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "enabled", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "true", + "generated": null, + "identity": null, + "name": "rate_limit_enabled", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rate_limit_time_window", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "rate_limit_max", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "request_count", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "remaining", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_request", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "permissions", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "apikey" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'pending'", + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "inviter_id", + "entityType": "columns", + "schema": "public", + "table": "invitation" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "organization_id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'member'", + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "member" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "logo", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "organization" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ip_address", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_agent", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "user_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "active_organization_id", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "impersonated_by", + "entityType": "columns", + "schema": "public", + "table": "session" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "email_verified", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "image", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "banned", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ban_reason", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "ban_expires", + "entityType": "columns", + "schema": "public", + "table": "user" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "identifier", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "value", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "created_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "timestamp", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "now()", + "generated": null, + "identity": null, + "name": "updated_at", + "entityType": "columns", + "schema": "public", + "table": "verification" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempt", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "outcome", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "started_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "window_expires_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "child_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "store_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "spec", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "failed_reason", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cascaded", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "pending_since", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "type": "bigserial", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "parent_store_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "report", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_flow_outbox" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_queue_control" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "paused", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_queue_control" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "job_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "cron", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "tz", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "every_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "payload", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempts_max", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backoff", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "keep", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "timeout_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "group_name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "next_run_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "queue", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "state", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "priority", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": { + "type": "byDefault", + "name": "effect_mq_jobs_seq_seq", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "9223372036854775807", + "cache": 1, + "cycle": false + }, + "name": "seq", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "payload", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "metadata", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "attempts_max", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "attempts_made", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "stalled_count", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "backoff", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "keep", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "bigint", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "timeout_ms", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "cancel_requested", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "dedupe_key", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "trace", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "parent", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_fail_fast", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_pending", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_completed", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_failed", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "flow_cancelled", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "run_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "enqueued_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "processed_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "finished_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "exit", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "failed_reason", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "lock_token", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "lock_expires_at", + "entityType": "columns", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "clusters_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "deployment_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployment_logs_deployment_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployment_logs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "cluster_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_cluster_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "resource_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_resource_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "name", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'queued'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "deployments_queued_idx", + "entityType": "indexes", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "git_connections_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "git_connections" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "git_oauth_providers_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "notification_channels_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "notification_channels" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "project_favorites_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "cluster_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "projects_cluster_idx", + "entityType": "indexes", + "schema": "public", + "table": "projects" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resource_groups_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "resource_groups" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "project_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_project_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "group_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_group_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "git_connection_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_git_connection_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "slug", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "resources_slug_idx", + "entityType": "indexes", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "s3_connections_organization_idx", + "entityType": "indexes", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "provider_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "account_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_providerId_accountId_uidx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "account_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "config_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_configId_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "reference_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_referenceId_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "key", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "apikey_key_idx", + "entityType": "indexes", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "invitation_organizationId_idx", + "entityType": "indexes", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "email", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "invitation_email_idx", + "entityType": "indexes", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "organization_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "member_organizationId_idx", + "entityType": "indexes", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "member_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "slug", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": true, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "organization_slug_uidx", + "entityType": "indexes", + "schema": "public", + "table": "organization" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "user_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "session_userId_idx", + "entityType": "indexes", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "identifier", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "verification_identifier_idx", + "entityType": "indexes", + "schema": "public", + "table": "verification" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "pending_since", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'pending'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_flow_children_pending_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "flow_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"status\" = 'cancelled' AND NOT \"cascaded\"", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_flow_children_cascade_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "next_run_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_schedules_due_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_schedules" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "queue", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "priority", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + }, + { + "value": "seq", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'waiting'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_ready_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "queue", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "run_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'delayed'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_delayed_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "lock_expires_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"state\" = 'active'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_active_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "name", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "state", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "finished_at", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_history_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "enqueued_at", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": false, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "effect_mq_jobs_listing_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "metadata", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": { + "name": "jsonb_path_ops", + "default": false + } + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "gin", + "concurrently": false, + "name": "effect_mq_jobs_metadata_idx", + "entityType": "indexes", + "schema": "public", + "table": "effect_mq_jobs" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "cluster_monitoring_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "cluster_monitoring" + }, + { + "nameExplicit": false, + "columns": ["caddy_resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "clusters_caddy_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "clusters_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "clusters" + }, + { + "nameExplicit": false, + "columns": ["deployment_id"], + "schemaTo": "public", + "tableTo": "deployments", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployment_logs_deployment_id_deployments_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployment_logs" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployments_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "deployments_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "deployments" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "git_connections_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "git_connections" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "git_oauth_providers_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "git_oauth_providers" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "notification_channels_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "notification_channels" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_favorites_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "project_favorites_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "project_favorites" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "projects_cluster_id_clusters_id_fk", + "entityType": "fks", + "schema": "public", + "table": "projects" + }, + { + "nameExplicit": false, + "columns": ["deployment_id"], + "schemaTo": "public", + "tableTo": "deployments", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resource_deployment_inputs_deployment_id_deployments_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resource_deployment_inputs" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resource_groups_project_id_projects_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "resource_groups" + }, + { + "nameExplicit": false, + "columns": ["git_connection_id"], + "schemaTo": "public", + "tableTo": "git_connections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "resources_git_connection_id_git_connections_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "schemaTo": "public", + "tableTo": "projects", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "resources_project_id_projects_id_fk", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["group_id"], + "schemaTo": "public", + "tableTo": "resource_groups", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "resources_group_id_resource_groups_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "resources" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "s3_buckets_resource_id_resources_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": false, + "columns": ["connection_id"], + "schemaTo": "public", + "tableTo": "s3_connections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "s3_buckets_connection_id_s3_connections_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "s3_connections_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandbox_images_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandbox_images" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_organization_id_organization_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sandboxes_cluster_id_clusters_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["volume_id"], + "schemaTo": "public", + "tableTo": "volumes", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "sandboxes_volume_id_volumes_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "user_settings_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "user_settings" + }, + { + "nameExplicit": false, + "columns": ["cluster_id"], + "schemaTo": "public", + "tableTo": "clusters", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "volumes_cluster_id_clusters_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "volumes_resource_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "account_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "account" + }, + { + "nameExplicit": false, + "columns": ["reference_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "apikey_reference_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "apikey" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "invitation_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": false, + "columns": ["inviter_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "invitation_inviter_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "invitation" + }, + { + "nameExplicit": false, + "columns": ["organization_id"], + "schemaTo": "public", + "tableTo": "organization", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "member_organization_id_organization_id_fk", + "entityType": "fks", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "member_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "member" + }, + { + "nameExplicit": false, + "columns": ["user_id"], + "schemaTo": "public", + "tableTo": "user", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "session_user_id_user_id_fk", + "entityType": "fks", + "schema": "public", + "table": "session" + }, + { + "nameExplicit": false, + "columns": ["job_id"], + "schemaTo": "public", + "tableTo": "effect_mq_jobs", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "effect_mq_job_attempts_job_id_effect_mq_jobs_id_fk", + "entityType": "fks", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "columns": ["user_id", "project_id"], + "nameExplicit": false, + "name": "project_favorites_user_id_project_id_pk", + "entityType": "pks", + "schema": "public", + "table": "project_favorites" + }, + { + "columns": ["job_id", "attempt"], + "nameExplicit": false, + "name": "effect_mq_job_attempts_job_id_attempt_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_job_attempts" + }, + { + "columns": ["name", "key"], + "nameExplicit": false, + "name": "effect_mq_dedupe_name_key_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_dedupe" + }, + { + "columns": ["flow_id", "child_key"], + "nameExplicit": false, + "name": "effect_mq_flow_children_flow_id_child_key_pk", + "entityType": "pks", + "schema": "public", + "table": "effect_mq_flow_children" + }, + { + "columns": ["cluster_id"], + "nameExplicit": false, + "name": "cluster_monitoring_pkey", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "clusters_pkey", + "schema": "public", + "table": "clusters", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "deployment_logs_pkey", + "schema": "public", + "table": "deployment_logs", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "deployments_pkey", + "schema": "public", + "table": "deployments", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "git_connections_pkey", + "schema": "public", + "table": "git_connections", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "git_oauth_providers_pkey", + "schema": "public", + "table": "git_oauth_providers", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "instance_settings_pkey", + "schema": "public", + "table": "instance_settings", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "notification_channels_pkey", + "schema": "public", + "table": "notification_channels", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "projects_pkey", + "schema": "public", + "table": "projects", + "entityType": "pks" + }, + { + "columns": ["deployment_id"], + "nameExplicit": false, + "name": "resource_deployment_inputs_pkey", + "schema": "public", + "table": "resource_deployment_inputs", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "resource_groups_pkey", + "schema": "public", + "table": "resource_groups", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "resources_pkey", + "schema": "public", + "table": "resources", + "entityType": "pks" + }, + { + "columns": ["resource_id"], + "nameExplicit": false, + "name": "s3_buckets_pkey", + "schema": "public", + "table": "s3_buckets", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "s3_connections_pkey", + "schema": "public", + "table": "s3_connections", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "sandbox_images_pkey", + "schema": "public", + "table": "sandbox_images", + "entityType": "pks" + }, + { + "columns": ["resource_id"], + "nameExplicit": false, + "name": "sandboxes_pkey", + "schema": "public", + "table": "sandboxes", + "entityType": "pks" + }, + { + "columns": ["user_id"], + "nameExplicit": false, + "name": "user_settings_pkey", + "schema": "public", + "table": "user_settings", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "volumes_pkey", + "schema": "public", + "table": "volumes", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "account_pkey", + "schema": "public", + "table": "account", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "apikey_pkey", + "schema": "public", + "table": "apikey", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "invitation_pkey", + "schema": "public", + "table": "invitation", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "member_pkey", + "schema": "public", + "table": "member", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "organization_pkey", + "schema": "public", + "table": "organization", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "session_pkey", + "schema": "public", + "table": "session", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "user_pkey", + "schema": "public", + "table": "user", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "verification_pkey", + "schema": "public", + "table": "verification", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "effect_mq_flow_outbox_pkey", + "schema": "public", + "table": "effect_mq_flow_outbox", + "entityType": "pks" + }, + { + "columns": ["queue"], + "nameExplicit": false, + "name": "effect_mq_queue_control_pkey", + "schema": "public", + "table": "effect_mq_queue_control", + "entityType": "pks" + }, + { + "columns": ["key"], + "nameExplicit": false, + "name": "effect_mq_schedules_pkey", + "schema": "public", + "table": "effect_mq_schedules", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "effect_mq_jobs_pkey", + "schema": "public", + "table": "effect_mq_jobs", + "entityType": "pks" + }, + { + "nameExplicit": true, + "columns": ["connection_id", "name"], + "nullsNotDistinct": false, + "name": "s3_buckets_connection_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "s3_buckets" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "name"], + "nullsNotDistinct": false, + "name": "s3_connections_organization_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "s3_connections" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "provider", "image"], + "nullsNotDistinct": false, + "name": "sandbox_images_organization_image_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandbox_images" + }, + { + "nameExplicit": true, + "columns": ["organization_id", "slug"], + "nullsNotDistinct": false, + "name": "sandboxes_organization_slug_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["cluster_id", "ssh_port"], + "nullsNotDistinct": false, + "name": "sandboxes_cluster_ssh_port_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["volume_id"], + "nullsNotDistinct": false, + "name": "sandboxes_volume_uidx", + "entityType": "uniques", + "schema": "public", + "table": "sandboxes" + }, + { + "nameExplicit": true, + "columns": ["cluster_id", "name"], + "nullsNotDistinct": false, + "name": "volumes_cluster_name_uidx", + "entityType": "uniques", + "schema": "public", + "table": "volumes" + }, + { + "nameExplicit": false, + "columns": ["project_id"], + "nullsNotDistinct": false, + "name": "cluster_monitoring_project_id_unique", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["resource_id"], + "nullsNotDistinct": false, + "name": "cluster_monitoring_resource_id_unique", + "schema": "public", + "table": "cluster_monitoring", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["job_id"], + "nullsNotDistinct": false, + "name": "deployments_job_id_unique", + "schema": "public", + "table": "deployments", + "entityType": "uniques" + }, + { + "nameExplicit": true, + "columns": ["resource_id"], + "nullsNotDistinct": false, + "name": "volumes_resource_uidx", + "schema": "public", + "table": "volumes", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["slug"], + "nullsNotDistinct": false, + "name": "organization_slug_unique", + "schema": "public", + "table": "organization", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["token"], + "nullsNotDistinct": false, + "name": "session_token_unique", + "schema": "public", + "table": "session", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["email"], + "nullsNotDistinct": false, + "name": "user_email_unique", + "schema": "public", + "table": "user", + "entityType": "uniques" + }, + { + "value": "\"id\" = 1", + "name": "instance_settings_singleton", + "entityType": "checks", + "schema": "public", + "table": "instance_settings" + }, + { + "value": "\"type\" in ('discord', 'telegram', 'ntfy', 'gchat', 'webhook')", + "name": "notification_channels_type_check", + "entityType": "checks", + "schema": "public", + "table": "notification_channels" + }, + { + "value": "\"status\" in ('provisioning', 'ready', 'failed', 'deleting')", + "name": "s3_buckets_status_check", + "entityType": "checks", + "schema": "public", + "table": "s3_buckets" + }, + { + "value": "\"provider\" in ('generic', 'rustfs', 'r2')", + "name": "s3_connections_provider_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "(\"provider\" = 'r2') = (\n \"provider_account_id\" is not null and \"encrypted_api_token\" is not null\n )", + "name": "s3_connections_provider_account_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "\"last_test_status\" in ('success', 'failure') or \"last_test_status\" is null", + "name": "s3_connections_test_status_check", + "entityType": "checks", + "schema": "public", + "table": "s3_connections" + }, + { + "value": "\"provider\" in ('uncloud')", + "name": "sandbox_images_provider_check", + "entityType": "checks", + "schema": "public", + "table": "sandbox_images" + }, + { + "value": "\"provider\" in ('uncloud')", + "name": "sandboxes_provider_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"status\" in ('provisioning', 'running', 'failed', 'destroying')", + "name": "sandboxes_status_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"ttl_seconds\" is null or \"ttl_seconds\" > 0", + "name": "sandboxes_ttl_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"slug\" ~ '^[a-z0-9]([-a-z0-9]*[a-z0-9])?$' and length(\"slug\") <= 55", + "name": "sandboxes_slug_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "(\"provider\" = 'uncloud') = (\"cluster_id\" is not null and \"ssh_port\" is not null)", + "name": "sandboxes_cluster_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + }, + { + "value": "\"ssh_port\" is null or \"ssh_port\" between 1 and 65535", + "name": "sandboxes_ssh_port_check", + "entityType": "checks", + "schema": "public", + "table": "sandboxes" + } + ], + "renames": [] +} diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts index b6c61240..c5875763 100644 --- a/packages/db/src/schema/index.ts +++ b/packages/db/src/schema/index.ts @@ -555,6 +555,7 @@ export const sandboxImages = t.pgTable( .notNull() .references(() => organization.id, { onDelete: "cascade" }), provider: t.text("provider").$type().notNull(), + name: t.text("name"), // An OCI reference on Uncloud, the provider's own image ID elsewhere; also its label in the UI. image: t.text("image").notNull(), createdAt: t @@ -685,4 +686,51 @@ export const sandboxes = t.pgTable( ], ); +export type NotificationEvent = "deployment.succeeded" | "deployment.failed"; + +/** Where a channel delivers. Webhook URLs and bot tokens are credentials. */ +export type NotificationChannelConfig = + | { type: "discord"; webhookUrl: string } + | { type: "telegram"; botToken: string; chatId: string } + | { type: "ntfy"; serverUrl: string; topic: string; token?: string } + | { type: "gchat"; webhookUrl: string } + | { type: "webhook"; url: string; secret?: string }; + +export type NotificationChannelType = NotificationChannelConfig["type"]; + +// Where an organization hears about deployments settling. The destination is never returned to +// the browser; changing it means adding the channel again. +export const notificationChannels = t.pgTable( + "notification_channels", + { + id: t.uuid("id").primaryKey(), + organizationId: t + .text("organization_id") + .notNull() + .references(() => organization.id, { onDelete: "cascade" }), + name: t.text("name").notNull(), + type: t.text("type").$type().notNull(), + // JSON of `NotificationChannelConfig`, including its type. + config: encryptedText("config", "notification-channel").notNull(), + events: t.jsonb("events").$type().notNull(), + enabled: t.boolean("enabled").notNull().default(true), + createdAt: t + .timestamp("created_at", { withTimezone: true }) + .notNull() + .$defaultFn(() => new Date()), + updatedAt: t + .timestamp("updated_at", { withTimezone: true }) + .notNull() + .$defaultFn(() => new Date()) + .$onUpdate(() => new Date()), + }, + (table) => [ + t.index("notification_channels_organization_idx").on(table.organizationId), + t.check( + "notification_channels_type_check", + sql`${table.type} in ('discord', 'telegram', 'ntfy', 'gchat', 'webhook')`, + ), + ], +); + export * from "./auth"; diff --git a/packages/workflows/src/blocked-address.ts b/packages/workflows/src/blocked-address.ts new file mode 100644 index 00000000..7ffe54cd --- /dev/null +++ b/packages/workflows/src/blocked-address.ts @@ -0,0 +1,35 @@ +import { isIP } from "node:net"; + +// Private networks (RFC1918, IPv6 ULA) are allowed: Git servers and notification targets often live +// on the LAN. Loopback, link-local, cloud metadata, transition and special-use ranges never are. +export function isBlockedAddress(address: string): boolean { + if (isIP(address) === 4) { + const [a = 0, b = 0, c = 0] = address.split(".").map(Number); + + return ( + address === "168.63.129.16" || // Azure platform/metadata services. + a === 0 || + a === 127 || + a >= 224 || + (a === 100 && b >= 64 && b <= 127) || + (a === 169 && b === 254) || + (a === 192 && ((b === 0 && (c === 0 || c === 2)) || (b === 88 && c === 99))) || + (a === 198 && (b === 18 || b === 19 || (b === 51 && c === 100))) || + (a === 203 && b === 0 && c === 113) + ); + } + + if (isIP(address) !== 6) return true; + const normalized = new URL(`https://[${address}]/`).hostname.slice(1, -1); + const first = Number.parseInt(normalized.split(":")[0] || "0", 16); + + if (normalized === "fd00:ec2::254" || normalized === "fd20:ce::254") return true; + + if ((first & 0xfe00) === 0xfc00) return false; + + // Only global unicast; exclude mapped IPv4, NAT64, Teredo, 6to4 and documentation ranges. + if (first < 0x2000 || first > 0x3fff || first === 0x2002 || first === 0x3fff) return true; + const second = Number.parseInt(normalized.split(":")[1] || "0", 16); + + return first === 0x2001 && (second < 0x200 || second === 0xdb8); +} diff --git a/packages/workflows/src/jobs.ts b/packages/workflows/src/jobs.ts index bf3679ca..26e74d15 100644 --- a/packages/workflows/src/jobs.ts +++ b/packages/workflows/src/jobs.ts @@ -246,3 +246,31 @@ export const AddMachine: Job.Job<"AddMachine", typeof resourcePayload, Schema.Vo }, }, }); + +const notificationPayload = Schema.Struct({ + deploymentId: Schema.String, + channelId: Schema.String, +}); + +// One per channel, so a channel that's down retries without repeating the message elsewhere. +export const SendNotification: Job.Job< + "SendNotification", + typeof notificationPayload, + Schema.Void, + Schema.Never +> = Job.make("SendNotification", { + payload: notificationPayload, + success: Schema.Void, + idempotencyKey: ({ deploymentId, channelId }) => `${deploymentId}:${channelId}`, + queue: "notifications", + defaults: { + attempts: 5, + backoff: { type: "exponential", delay: "15 seconds" }, + timeout: "30 seconds", + keep: { + // Long enough that a repeated settle for the same deployment is deduplicated. + completed: { age: "1 day" }, + failed: { age: "7 days" }, + }, + }, +}); diff --git a/packages/workflows/src/lifecycle.ts b/packages/workflows/src/lifecycle.ts index 63be4edd..38117ec5 100644 --- a/packages/workflows/src/lifecycle.ts +++ b/packages/workflows/src/lifecycle.ts @@ -36,7 +36,7 @@ export function startWorker( globalThis.__clowderWorker = running; process.on("sveltekit:shutdown", running.stop); console.log( - "[worker] starting deployment worker (queues: initialize, deploy, buckets, sandboxes, monitoring, health, git, provision, machines)", + "[worker] starting deployment worker (queues: initialize, deploy, buckets, sandboxes, monitoring, health, git, provision, machines, notifications)", ); // One interruptible parent owns both loops and waits for layer finalizers on shutdown. diff --git a/packages/workflows/src/notifications/notice.ts b/packages/workflows/src/notifications/notice.ts new file mode 100644 index 00000000..615f8434 --- /dev/null +++ b/packages/workflows/src/notifications/notice.ts @@ -0,0 +1,204 @@ +import { appUrl } from "@clowder/config/env"; +import type { Database } from "@clowder/db"; +import { + clusters, + type DeploymentMetadata, + deployments, + type NotificationEvent, + projects, + resources, +} from "@clowder/db/schema/index"; +import { eq } from "drizzle-orm"; + +/** One message, rendered by each channel in its own format. */ +export type Notice = { + event: NotificationEvent | "test"; + tone: "success" | "failure" | "info"; + title: string; + /** Why it failed, or the test's explanation. */ + detail: string | null; + /** The deployment page; null without APP_URL, since a localhost link helps nobody. */ + url: string | null; + facts: { label: string; value: string }[]; + at: Date; + deployment: DeploymentSummary | null; +}; + +/** What generic webhooks receive about the deployment. */ +export type DeploymentSummary = { + id: string; + kind: string; + status: "ready" | "failed"; + error: string | null; + cluster: { id: string; name: string }; + project: { id: string; name: string } | null; + resource: { id: string; name: string } | null; + trigger: DeploymentMetadata["trigger"] | null; + commit: { sha: string; message: string } | null; + createdAt: string; + finishedAt: string | null; +}; + +export type SettledDeployment = { + id: string; + name: string; + status: string; + error: string | null; + metadata: DeploymentMetadata | null; + createdAt: Date; + finishedAt: Date | null; + cluster: { id: string; name: string; organizationId: string }; + resource: { id: string; name: string } | null; + project: { id: string; name: string } | null; +}; + +// Keyed by the deployment's job name. +function titles(name: string): [success: string, failure: string] { + switch (name) { + case "DeployResource": + return ["{resource} deployed", "{resource} failed to deploy"]; + case "ProvisionCluster": + return ["Cluster {cluster} is ready", "Setting up cluster {cluster} failed"]; + case "AddMachine": + return ["Machine added to {cluster}", "Adding a machine to {cluster} failed"]; + case "InitializeCluster": + return [ + "Monitoring is ready on {cluster}", + "Setting up monitoring on {cluster} failed", + ]; + case "ProvisionSandbox": + return ["Sandbox {resource} is running", "Creating sandbox {resource} failed"]; + case "DestroySandbox": + return ["Sandbox {resource} destroyed", "Destroying sandbox {resource} failed"]; + default: + return ["Deployment finished", "Deployment failed"]; + } +} + +const triggers: Record = { + manual: "Manual", + webhook: "Git push", + poll: "Git push (polled)", +}; + +export async function loadSettledDeployment( + db: Database, + deploymentId: string, +): Promise { + const [row] = await db + .select({ + id: deployments.id, + name: deployments.name, + status: deployments.status, + error: deployments.error, + metadata: deployments.metadata, + createdAt: deployments.createdAt, + finishedAt: deployments.finishedAt, + cluster: { + id: clusters.id, + name: clusters.name, + organizationId: clusters.organizationId, + }, + resource: { id: resources.id, name: resources.name }, + project: { id: projects.id, name: projects.name }, + }) + .from(deployments) + .innerJoin(clusters, eq(clusters.id, deployments.clusterId)) + .leftJoin(resources, eq(resources.id, deployments.resourceId)) + .leftJoin(projects, eq(projects.id, resources.projectId)) + .where(eq(deployments.id, deploymentId)) + .limit(1); + + return row ?? null; +} + +export function deploymentEvent(status: string): NotificationEvent | null { + if (status === "ready") return "deployment.succeeded"; + + if (status === "failed") return "deployment.failed"; + + return null; +} + +export function deploymentNotice(deployment: SettledDeployment): Notice | null { + const event = deploymentEvent(deployment.status); + + if (!event) return null; + const failed = event === "deployment.failed"; + const [success, failure] = titles(deployment.name); + + const title = (failed ? failure : success) + .replace("{resource}", deployment.resource?.name ?? "A resource") + .replace("{cluster}", deployment.cluster.name); + + const commit = deployment.metadata?.commit ?? null; + const trigger = deployment.metadata?.trigger ?? null; + const base = appUrl(); + + const facts = [ + deployment.project && { label: "Project", value: deployment.project.name }, + { label: "Cluster", value: deployment.cluster.name }, + trigger && { label: "Trigger", value: triggers[trigger] }, + commit && { + label: "Commit", + value: `${commit.sha.slice(0, 7)} ${firstLine(commit.message)}`.trim(), + }, + deployment.finishedAt && { + label: "Duration", + value: formatDuration(deployment.finishedAt.getTime() - deployment.createdAt.getTime()), + }, + ].flatMap((fact) => (fact ? [fact] : [])); + + return { + event, + tone: failed ? "failure" : "success", + title, + detail: failed ? (deployment.error ?? "No reason was recorded.") : null, + url: base ? new URL(`/deployments/${deployment.id}`, base).toString() : null, + facts, + at: deployment.finishedAt ?? new Date(), + deployment: { + id: deployment.id, + kind: deployment.name, + status: failed ? "failed" : "ready", + error: deployment.error, + cluster: { id: deployment.cluster.id, name: deployment.cluster.name }, + project: deployment.project, + resource: deployment.resource, + trigger, + commit, + createdAt: deployment.createdAt.toISOString(), + finishedAt: deployment.finishedAt?.toISOString() ?? null, + }, + }; +} + +export function testNotice(channelName: string): Notice { + return { + event: "test", + tone: "info", + title: "Test notification", + detail: `${channelName} is set up. Deployments will show up here when they finish.`, + url: appUrl() ?? null, + facts: [], + at: new Date(), + deployment: null, + }; +} + +function firstLine(text: string) { + const line = text.split("\n", 1)[0]!.trim(); + + return line.length > 72 ? `${line.slice(0, 71)}…` : line; +} + +export function formatDuration(ms: number) { + const seconds = Math.max(0, Math.round(ms / 1000)); + + if (seconds < 60) return `${seconds}s`; + const minutes = Math.floor(seconds / 60); + + if (minutes < 60) return `${minutes}m ${String(seconds % 60).padStart(2, "0")}s`; + + return `${Math.floor(minutes / 60)}h ${String(minutes % 60).padStart(2, "0")}m`; +} diff --git a/packages/workflows/src/notifications/render.ts b/packages/workflows/src/notifications/render.ts new file mode 100644 index 00000000..8e453f7f --- /dev/null +++ b/packages/workflows/src/notifications/render.ts @@ -0,0 +1,211 @@ +import type { NotificationChannelConfig } from "@clowder/db/schema/index"; +import { createHmac } from "node:crypto"; +import type { Notice } from "./notice"; + +/** One HTTP POST that delivers a notice. */ +export type Delivery = { url: string; headers: Record; body: string }; + +const colors = { success: 0x22c55e, failure: 0xef4444, info: 0x3b82f6 }; + +const emoji = { success: "✅", failure: "🚨", info: "🔔" }; + +/** `sender` is the channel's name; services that let a message pick its author show it. */ +export function render( + config: NotificationChannelConfig, + notice: Notice, + sender: string, +): Delivery { + switch (config.type) { + case "discord": + return json(config.webhookUrl, JSON.stringify(discord(notice, sender))); + case "telegram": + return json( + `https://api.telegram.org/bot${config.botToken}/sendMessage`, + JSON.stringify(telegram(notice, config.chatId)), + ); + case "ntfy": + return json( + config.serverUrl.replace(/\/+$/u, ""), + JSON.stringify(ntfy(notice, config.topic)), + config.token ? { authorization: `Bearer ${config.token}` } : {}, + ); + case "gchat": + return json(config.webhookUrl, JSON.stringify(gchat(notice))); + case "webhook": + return webhook(config.url, notice, config.secret); + } +} + +function json(url: string, body: string, headers: Delivery["headers"] = {}): Delivery { + return { url, headers: { "content-type": "application/json", ...headers }, body }; +} + +export function clip(text: string, max: number) { + return text.length > max ? `${text.slice(0, max - 1)}…` : text; +} + +// Error text is the user's own output, so it may hold a fence or HTML of its own. +function codeBlock(text: string) { + return `\`\`\`\n${clip(text, 1500).replaceAll("```", "`​``")}\n\`\`\``; +} + +export function escapeHtml(text: string) { + return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"); +} + +// Limits are Discord's (title 256, field 1024, 25 fields, 6000 per embed); clipping keeps us well under. +// Discord refuses names containing "discord" or "clyde", and "everyone" or "here", so those keep +// the webhook's own name. +function discordUsername(sender: string) { + const name = clip(sender.trim(), 80); + + return /discord|clyde/iu.test(name) || /^(?:everyone|here)$/iu.test(name) ? undefined : name; +} + +export function discord(notice: Notice, sender: string) { + return { + username: discordUsername(sender), + // A commit message saying @everyone must not ping the server. + allowed_mentions: { parse: [] }, + embeds: [ + { + title: clip(`${emoji[notice.tone]} ${notice.title}`, 256), + // JSON.stringify drops the undefined ones. + url: notice.url ?? undefined, + description: notice.detail + ? notice.event === "test" + ? notice.detail + : codeBlock(notice.detail) + : undefined, + color: colors[notice.tone], + fields: notice.facts.slice(0, 25).map((fact) => ({ + name: clip(fact.label, 256), + value: clip(fact.value, 256), + inline: true, + })), + timestamp: notice.at.toISOString(), + footer: { text: "Clowder" }, + }, + ], + }; +} + +export function telegram(notice: Notice, chatId: string) { + const lines = [`${emoji[notice.tone]} ${escapeHtml(notice.title)}`]; + + if (notice.detail) + lines.push( + "", + notice.event === "test" + ? escapeHtml(notice.detail) + : `
${escapeHtml(clip(notice.detail, 1500))}
`, + ); + + if (notice.facts.length) lines.push(""); + + for (const fact of notice.facts) + lines.push(`${escapeHtml(fact.label)}: ${escapeHtml(fact.value)}`); + + if (notice.url) lines.push("", `Open deployment`); + + return { + chat_id: chatId, + text: lines.join("\n"), + parse_mode: "HTML", + link_preview_options: { is_disabled: true }, + }; +} + +// JSON publishing to the server root, so non-ASCII titles survive (headers would mangle them). +export function ntfy(notice: Notice, topic: string) { + const lines = notice.facts.map((fact) => `**${fact.label}:** ${fact.value}`); + + if (notice.detail) + lines.unshift(notice.event === "test" ? notice.detail : codeBlock(notice.detail), ""); + + return { + topic, + title: notice.title, + message: lines.join("\n").trim() || notice.title, + markdown: true, + tags: [ + { success: "white_check_mark", failure: "rotating_light", info: "bell" }[notice.tone], + ], + priority: notice.tone === "failure" ? 4 : 3, + click: notice.url ?? undefined, + actions: notice.url + ? [{ action: "view", label: "Open deployment", url: notice.url }] + : undefined, + }; +} + +export function gchat(notice: Notice) { + const widgets: object[] = notice.facts.map((fact) => ({ + decoratedText: { topLabel: fact.label, text: escapeHtml(fact.value) }, + })); + + if (notice.url) + widgets.push({ + buttonList: { + buttons: [{ text: "Open deployment", onClick: { openLink: { url: notice.url } } }], + }, + }); + + const sections: object[] = []; + + if (notice.detail) + sections.push({ + widgets: [{ textParagraph: { text: escapeHtml(clip(notice.detail, 1500)) } }], + }); + + if (widgets.length) sections.push({ widgets }); + + return { + // Shown in notifications and clients without card support. + text: `${emoji[notice.tone]} ${notice.title}`, + cardsV2: [ + { + cardId: "clowder-notification", + card: { + header: { + title: clip(notice.title, 200), + subtitle: { success: "Succeeded", failure: "Failed", info: "Clowder" }[ + notice.tone + ], + }, + sections, + }, + }, + ], + }; +} + +/** + * Signed like Stripe: `X-Clowder-Signature: sha256=.">`, so a + * receiver can reject forged and replayed requests without the secret ever being sent. + */ +export function webhook(url: string, notice: Notice, secret?: string): Delivery { + // Send time, not the deployment's, so a retried delivery still passes a replay window. + const timestamp = Math.floor(Date.now() / 1000).toString(); + + const body = JSON.stringify({ + event: notice.event, + title: notice.title, + detail: notice.detail, + url: notice.url, + timestamp: notice.at.toISOString(), + deployment: notice.deployment, + }); + + const headers: Delivery["headers"] = { + "content-type": "application/json", + "x-clowder-event": notice.event, + "x-clowder-timestamp": timestamp, + }; + + if (secret) + headers["x-clowder-signature"] = + `sha256=${createHmac("sha256", secret).update(`${timestamp}.${body}`).digest("hex")}`; + + return { url, headers, body }; +} diff --git a/packages/workflows/src/notifications/send.ts b/packages/workflows/src/notifications/send.ts new file mode 100644 index 00000000..4d8bfbd2 --- /dev/null +++ b/packages/workflows/src/notifications/send.ts @@ -0,0 +1,151 @@ +import type { Database } from "@clowder/db"; +import { type NotificationChannelConfig, notificationChannels } from "@clowder/db/schema/index"; +import { and, eq, sql } from "drizzle-orm"; +import { Effect } from "effect"; +import { lookup } from "node:dns"; +import { request as httpRequest } from "node:http"; +import { request as httpsRequest } from "node:https"; +import { isIP, type LookupFunction } from "node:net"; +import { isBlockedAddress } from "../blocked-address"; +import { SendNotification } from "../jobs"; +import { JobStoreLive } from "../store"; +import { deploymentEvent, deploymentNotice, loadSettledDeployment, type Notice } from "./notice"; +import { type Delivery, render } from "./render"; + +const TIMEOUT_MS = 10_000; + +// Checks every address at connect time, so the request goes to the address that was checked. +const publicLookup: LookupFunction = (hostname, options, callback) => { + lookup(hostname, { ...options, all: true }, (error, addresses) => { + if (error) return callback(error, ""); + + const first = addresses[0]; + + if (!first || addresses.some(({ address }) => isBlockedAddress(address))) + return callback( + new Error(`${hostname} resolves to an address Clowder won't call.`), + "", + ); + + if (options.all) callback(null, addresses); + else callback(null, first.address, first.family); + }); +}; + +/** + * POSTs a delivery. No redirects, and the response body is never read, so a user-entered URL can't + * be used to read internal services. + */ +export function post(delivery: Delivery, signal: AbortSignal): Promise { + const url = new URL(delivery.url); + const host = url.hostname.replace(/^\[|\]$/gu, ""); + + if (url.protocol !== "https:" && url.protocol !== "http:") + return Promise.reject(new Error("Only http and https URLs can be notified.")); + + // Literal addresses skip the lookup. + if (isIP(host) && isBlockedAddress(host)) + return Promise.reject(new Error(`${host} is an address Clowder won't call.`)); + + return new Promise((resolve, reject) => { + const request = (url.protocol === "https:" ? httpsRequest : httpRequest)( + url, + { + method: "POST", + headers: { "user-agent": "Clowder", ...delivery.headers }, + lookup: publicLookup, + signal, + }, + (response) => { + response.resume(); + const status = response.statusCode ?? 0; + + if (status >= 200 && status < 300) resolve(); + else reject(new Error(`The channel responded with HTTP ${status}.`)); + }, + ); + + request.on("error", reject); + request.end(delivery.body); + }); +} + +export function sendNotice( + config: NotificationChannelConfig, + sender: string, + notice: Notice, + signal?: AbortSignal, +) { + const timeout = AbortSignal.timeout(TIMEOUT_MS); + + return post( + render(config, notice, sender), + signal ? AbortSignal.any([signal, timeout]) : timeout, + ); +} + +export function readChannelConfig(stored: string): NotificationChannelConfig { + // SAFETY: only the notifications router writes this column, from a validated config. + return JSON.parse(stored) as NotificationChannelConfig; +} + +/** + * Queues one `SendNotification` per enabled channel that wants this deployment's outcome. Call it + * after a deployment settles; it skips anything but ready or failed, and repeats are deduplicated. + * Never throws, so a notification never fails a deployment. + */ +export async function notifyDeploymentSettled(db: Database, deploymentId: string) { + try { + const deployment = await loadSettledDeployment(db, deploymentId); + const event = deployment && deploymentEvent(deployment.status); + + if (!event) return; + + const channels = await db + .select({ id: notificationChannels.id }) + .from(notificationChannels) + .where( + and( + eq(notificationChannels.organizationId, deployment.cluster.organizationId), + eq(notificationChannels.enabled, true), + sql`${notificationChannels.events} @> ${JSON.stringify([event])}::jsonb`, + ), + ); + + if (!channels.length) return; + + await Effect.runPromise( + Effect.forEach( + channels, + ({ id }) => SendNotification.enqueue({ deploymentId, channelId: id }), + { discard: true }, + ).pipe(Effect.provide(JobStoreLive)), + ); + } catch (error) { + console.error(`[notifications] Could not queue notifications for ${deploymentId}:`, error); + } +} + +/** The `SendNotification` job: deliver one deployment's outcome to one channel. */ +export async function deliverNotification( + db: Database, + deploymentId: string, + channelId: string, + signal: AbortSignal, +) { + const [channel] = await db + .select() + .from(notificationChannels) + .where(eq(notificationChannels.id, channelId)) + .limit(1); + + // Removed or paused since it was queued. + if (!channel?.enabled) return; + + const deployment = await loadSettledDeployment(db, deploymentId); + const notice = deployment && deploymentNotice(deployment); + + if (!notice || deployment.cluster.organizationId !== channel.organizationId) return; + + await sendNotice(readChannelConfig(channel.config), channel.name, notice, signal); +} diff --git a/packages/workflows/src/runtime.ts b/packages/workflows/src/runtime.ts index 98dc62f1..042a4c2a 100644 --- a/packages/workflows/src/runtime.ts +++ b/packages/workflows/src/runtime.ts @@ -26,8 +26,10 @@ import { DestroySandbox, ProvisionSandbox, RollOutMonitoring, + SendNotification, WatchGitSources, } from "./jobs"; +import { deliverNotification, notifyDeploymentSettled } from "./notifications/send"; import { provisionCluster } from "./provision-cluster"; import { reconcileBucket } from "./reconcile-bucket"; import { destroySandbox, provisionSandbox } from "./sandbox"; @@ -93,6 +95,8 @@ async function runAttemptAsync( } await setInitializationStatus(db, clusterId, "ready", null).catch(() => {}); + + if (deployment) await notifyDeploymentSettled(db, deployment.id); } // Never rolls monitoring backward: a newer version's job waits for a newer worker, and a stale @@ -147,7 +151,10 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { DeployResource.toLayer( ({ deploymentId }) => attempt( - (signal) => deployResource(db, deploymentId, signal), + (signal) => + deployResource(db, deploymentId, signal).then(() => + notifyDeploymentSettled(db, deploymentId), + ), // Keep the redacted failure (and its unrecoverable mark), never a raw cause. (error) => error.message === RESOURCE_FAILURE_MESSAGE @@ -159,7 +166,10 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { ProvisionCluster.toLayer( ({ deploymentId }) => attempt( - (signal) => provisionCluster(db, deploymentId, signal), + (signal) => + provisionCluster(db, deploymentId, signal).then(() => + notifyDeploymentSettled(db, deploymentId), + ), // provisionCluster records its own failure; uc's messages carry no secrets. (error) => error, ), @@ -168,7 +178,10 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { AddMachine.toLayer( ({ deploymentId }) => attempt( - (signal) => addMachine(db, deploymentId, signal), + (signal) => + addMachine(db, deploymentId, signal).then(() => + notifyDeploymentSettled(db, deploymentId), + ), // addMachine records its own failure; uc's messages carry no secrets. (error) => error, ), @@ -185,7 +198,10 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { ProvisionSandbox.toLayer( ({ deploymentId }) => attempt( - (signal) => provisionSandbox(db, deploymentId, signal), + (signal) => + provisionSandbox(db, deploymentId, signal).then(() => + notifyDeploymentSettled(db, deploymentId), + ), // provisionSandbox records its own failure; deployCompose masks the password. (error) => error, ), @@ -194,7 +210,10 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { DestroySandbox.toLayer( ({ deploymentId }) => attempt( - (signal) => destroySandbox(db, deploymentId, signal), + (signal) => + destroySandbox(db, deploymentId, signal).then(() => + notifyDeploymentSettled(db, deploymentId), + ), // destroySandbox records its own failure; uc's messages carry no secrets. (error) => error, ), @@ -225,6 +244,15 @@ function jobHandlersLive(db: Database, watchGitSources: GitWatcher) { // A webhook check runs beside a slow poll instead of waiting behind it; row locks keep both safe. { concurrency: 2 }, ), + SendNotification.toLayer( + ({ deploymentId, channelId }) => + attempt( + (signal) => deliverNotification(db, deploymentId, channelId, signal), + // Status codes and resolver errors only; response bodies are never read. + (error) => error, + ), + { concurrency: 4 }, + ), ); } @@ -275,11 +303,22 @@ function deploymentFailureMessage(name: string) { return RESOURCE_FAILURE_MESSAGE; } +// effect-mq namespaces deterministic ids as `/`; deployments store the key. +function jobKey(jobId: string) { + return jobId.includes("/") ? jobId.slice(jobId.indexOf("/") + 1) : jobId; +} + +// A retry settles later, so only the last attempt's outcome is news. +async function notifyFailure(db: Database, failure: Worker.JobFailure) { + if (failure.willRetry) return; + const deployment = await getDeploymentByJobId(db, jobKey(failure.jobId)).catch(() => null); + + if (deployment) await notifyDeploymentSettled(db, deployment.id); +} + async function recordFailureAsync(db: Database, failure: Worker.JobFailure) { - // effect-mq namespaces deterministic ids as `/`, - // so strip the prefix before matching our `${clusterId}:${requestId}` shape. - const rawId = failure.jobId; - const key = rawId.includes("/") ? rawId.slice(rawId.indexOf("/") + 1) : rawId; + // Matches our `${clusterId}:${requestId}` shape once the prefix is stripped. + const key = jobKey(failure.jobId); const sep = key.indexOf(":"); const clusterId = sep === -1 ? key : key.slice(0, sep); const deployment = key ? await getDeploymentByJobId(db, key).catch(() => null) : null; @@ -367,6 +406,7 @@ function workerLive(db: Database) { git: { concurrency: 2 }, provision: { concurrency: 2 }, machines: { concurrency: 2 }, + notifications: { concurrency: 4 }, }, lockDuration: "10 minutes", // effect-mq also delivers cross-process cancellation on this heartbeat. @@ -389,7 +429,9 @@ function workerLive(db: Database) { ) return Effect.void; - return Effect.promise(() => recordFailureAsync(db, failure)).pipe(Effect.ignore); + return Effect.promise(() => + recordFailureAsync(db, failure).finally(() => notifyFailure(db, failure)), + ).pipe(Effect.ignore); }, }); } diff --git a/tests/api/notifications.test.ts b/tests/api/notifications.test.ts new file mode 100644 index 00000000..143bd805 --- /dev/null +++ b/tests/api/notifications.test.ts @@ -0,0 +1,131 @@ +import { call } from "@orpc/server"; +import { createDb } from "@clowder/db"; +import { migrate } from "drizzle-orm/node-postgres/migrator"; +import { randomUUID } from "node:crypto"; +import { resolve } from "node:path"; +import { afterAll, beforeAll, describe, expect, it } from "vite-plus/test"; +import type { Context } from "../../packages/api/src/context"; +import { notificationsRouter } from "../../packages/api/src/routers/notifications"; +import { insertUserWithOrganization } from "../users"; + +describe("notifications API", () => { + const databaseName = `clowder_notify_${randomUUID().replaceAll("-", "")}`; + let admin: ReturnType; + let db: ReturnType; + let member: Context; + let outsider: Context; + + function sessionContext(userId: string, organizationId: string) { + // SAFETY: these procedures read only the session identity and active organization. + return { + db, + session: { user: { id: userId }, session: { activeOrganizationId: organizationId } }, + } as Context; + } + + beforeAll(async () => { + admin = createDb({ DATABASE_URL: process.env.DATABASE_URL! }); + await admin.$client.query(`CREATE DATABASE "${databaseName}"`); + const url = new URL(process.env.DATABASE_URL!); + url.pathname = `/${databaseName}`; + db = createDb({ DATABASE_URL: url.toString() }); + await migrate(db, { migrationsFolder: resolve("packages/db/src/migrations") }); + + member = sessionContext( + "notify-member", + await insertUserWithOrganization(db, "notify-member", "Member", "m@example.test"), + ); + outsider = sessionContext( + "notify-outsider", + await insertUserWithOrganization(db, "notify-outsider", "Outsider", "o@example.test"), + ); + }, 30_000); + + afterAll(async () => { + await db?.$client.end(); + await admin?.$client.query(`DROP DATABASE IF EXISTS "${databaseName}" WITH (FORCE)`); + await admin?.$client.end(); + }); + + const webhookUrl = "https://discord.com/api/webhooks/123/secret-token"; + + it("creates, lists without the destination, pauses and removes a channel", async () => { + const created = await call( + notificationsRouter.create, + { + name: "#deploys", + events: ["deployment.failed"], + config: { type: "discord", webhookUrl }, + }, + { context: member }, + ); + + const listed = await call(notificationsRouter.list, undefined, { context: member }); + + expect(listed).toEqual([ + { + id: created.id, + name: "#deploys", + type: "discord", + events: ["deployment.failed"], + enabled: true, + }, + ]); + expect(JSON.stringify(listed)).not.toContain("secret-token"); + + // Matches the worker's lookup of channels that want an event. + const { rows } = await db.$client.query( + `SELECT id FROM notification_channels WHERE events @> $1::jsonb`, + [JSON.stringify(["deployment.failed"])], + ); + + expect(rows).toEqual([{ id: created.id }]); + + await expect( + call(notificationsRouter.list, undefined, { context: outsider }), + ).resolves.toEqual([]); + await expect( + call(notificationsRouter.remove, { channelId: created.id }, { context: outsider }), + ).rejects.toThrow(/not found/iu); + + const paused = await call( + notificationsRouter.setEnabled, + { channelId: created.id, enabled: false }, + { context: member }, + ); + + expect(paused.enabled).toBe(false); + await call(notificationsRouter.remove, { channelId: created.id }, { context: member }); + await expect( + call(notificationsRouter.list, undefined, { context: member }), + ).resolves.toEqual([]); + }); + + it("rejects destinations outside a service's own host", async () => { + await expect( + call( + notificationsRouter.create, + { + name: "Sneaky", + events: ["deployment.failed"], + config: { + type: "discord", + webhookUrl: "https://evil.example.com/api/webhooks/1/x", + }, + }, + { context: member }, + ), + ).rejects.toThrow(); + await expect( + call( + notificationsRouter.create, + { + name: "No events", + events: [], + config: { type: "webhook", url: "https://hooks.example.com" }, + }, + { context: member }, + ), + ).rejects.toThrow(); + }); +}); diff --git a/tests/workflows/notifications.test.ts b/tests/workflows/notifications.test.ts new file mode 100644 index 00000000..d7b8e46c --- /dev/null +++ b/tests/workflows/notifications.test.ts @@ -0,0 +1,160 @@ +import { createHmac } from "node:crypto"; +import { afterEach, describe, expect, it, vi } from "vite-plus/test"; +import { + deploymentNotice, + formatDuration, + type SettledDeployment, +} from "../../packages/workflows/src/notifications/notice"; +import { discord, render, telegram } from "../../packages/workflows/src/notifications/render"; +import { post } from "../../packages/workflows/src/notifications/send"; + +const failed: SettledDeployment = { + id: "0b6c3f3e-0000-4000-8000-000000000001", + name: "DeployResource", + status: "failed", + error: "Image not found\n```\n@everyone", + metadata: { + source: "github", + trigger: "webhook", + commit: { sha: "abcdef1234567890", message: "Fix @everyone bug\n\nlong body" }, + }, + createdAt: new Date("2026-11-23T10:00:00Z"), + finishedAt: new Date("2026-11-23T10:01:05Z"), + cluster: { id: "c1", name: "prod", organizationId: "org" }, + resource: { id: "r1", name: "api" }, + project: { id: "p1", name: "Shop" }, +}; + +afterEach(() => { + vi.unstubAllEnvs(); +}); + +describe("deployment notices", () => { + it("describes a failed resource deployment with its facts and link", () => { + vi.stubEnv("APP_URL", "https://clowder.example.com"); + const notice = deploymentNotice(failed)!; + + expect(notice.event).toBe("deployment.failed"); + expect(notice.title).toBe("api failed to deploy"); + expect(notice.url).toBe(`https://clowder.example.com/deployments/${failed.id}`); + expect(notice.facts).toEqual([ + { label: "Project", value: "Shop" }, + { label: "Cluster", value: "prod" }, + { label: "Trigger", value: "Git push" }, + { label: "Commit", value: "abcdef1 Fix @everyone bug" }, + { label: "Duration", value: "1m 05s" }, + ]); + }); + + it("leaves links out without APP_URL and skips unsettled deployments", () => { + vi.stubEnv("APP_URL", ""); + expect(deploymentNotice({ ...failed, status: "ready" })!.url).toBeNull(); + expect(deploymentNotice({ ...failed, status: "cancelled" })).toBeNull(); + expect(deploymentNotice({ ...failed, status: "running" })).toBeNull(); + }); + + it("formats durations", () => { + expect(formatDuration(4_200)).toBe("4s"); + expect(formatDuration(3_725_000)).toBe("1h 02m"); + }); +}); + +describe("channel messages", () => { + const notice = deploymentNotice(failed)!; + + it("keeps Discord from pinging and from breaking out of the error block", () => { + const payload = discord(notice, "sex defender"); + const embed = payload.embeds[0]!; + + expect(payload.allowed_mentions).toEqual({ parse: [] }); + expect(payload.username).toBe("sex defender"); + expect(embed.color).toBe(0xef4444); + expect(embed.description).toMatch(/^```\n/u); + expect(embed.description!.slice(4, -4)).not.toContain("```"); + expect(embed.fields.every((field) => field.value.length <= 256)).toBe(true); + }); + + it("keeps the webhook's own name when Discord would refuse the channel's", () => { + expect(discord(notice, "Discord deploys").username).toBeUndefined(); + expect(discord(notice, "everyone").username).toBeUndefined(); + expect(discord(notice, "x".repeat(100)).username).toHaveLength(80); + }); + + it("clips long errors for Discord", () => { + const embed = discord({ ...notice, detail: "x".repeat(10_000) }, "Deploys").embeds[0]!; + + expect(embed.description!.length).toBeLessThan(1600); + }); + + it("escapes user text in Telegram's HTML", () => { + const { text } = telegram(notice, "-100"); + + expect(text).toContain("Image <app> not found"); + expect(text).toContain("Fix @everyone <b>bug</b>"); + expect(text).not.toContain(""); + }); + + it("signs webhooks over the timestamp and body", () => { + const delivery = render( + { type: "webhook", url: "https://hooks.example.com", secret: "s3cret" }, + notice, + "Hooks", + ); + + const timestamp = delivery.headers["x-clowder-timestamp"]!; + + const expected = createHmac("sha256", "s3cret") + .update(`${timestamp}.${delivery.body}`) + .digest("hex"); + + expect(delivery.headers["x-clowder-signature"]).toBe(`sha256=${expected}`); + expect(JSON.parse(delivery.body).deployment.status).toBe("failed"); + expect( + render({ type: "webhook", url: "https://hooks.example.com" }, notice, "Hooks").headers, + ).not.toHaveProperty("x-clowder-signature"); + }); + + it("publishes ntfy as JSON to the server root with the token as a bearer", () => { + const delivery = render( + { + type: "ntfy", + serverUrl: "https://ntfy.example.com/", + topic: "deploys", + token: "tk_1", + }, + notice, + "Phone", + ); + + expect(delivery.url).toBe("https://ntfy.example.com"); + expect(delivery.headers.authorization).toBe("Bearer tk_1"); + expect(JSON.parse(delivery.body)).toMatchObject({ topic: "deploys", priority: 4 }); + }); +}); + +describe("delivery", () => { + const delivery = { headers: {}, body: "{}" }; + + it("refuses loopback and metadata addresses, literal or resolved", async () => { + const signal = AbortSignal.timeout(5_000); + + await expect(post({ ...delivery, url: "http://127.0.0.1:9/" }, signal)).rejects.toThrow( + /won't call/u, + ); + await expect(post({ ...delivery, url: "http://[::1]:9/" }, signal)).rejects.toThrow( + /won't call/u, + ); + await expect( + post({ ...delivery, url: "http://169.254.169.254/latest" }, signal), + ).rejects.toThrow(/won't call/u); + await expect(post({ ...delivery, url: "http://localhost:9/" }, signal)).rejects.toThrow( + /won't call/u, + ); + }); + + it("refuses other protocols", async () => { + await expect( + post({ ...delivery, url: "file:///etc/passwd" }, AbortSignal.timeout(1_000)), + ).rejects.toThrow(/http and https/u); + }); +});