diff --git a/dembrane/platform/apps/api/test/landscape-canary.integration.test.ts b/dembrane/platform/apps/api/test/landscape-canary.integration.test.ts new file mode 100644 index 000000000..d75419e94 --- /dev/null +++ b/dembrane/platform/apps/api/test/landscape-canary.integration.test.ts @@ -0,0 +1,485 @@ +import { afterAll, beforeAll, describe, expect, setDefaultTimeout, test } from "bun:test"; +import { DrizzleAccessStore } from "@dembrane/access"; +import { + AnalysisStore, + countConversationsWithTranscripts, + loadTranscripts, +} from "@dembrane/analysis"; +import { canvasStore, executeGatherSpec } from "@dembrane/canvas"; +import { chatReads } from "@dembrane/chats"; +import { adjacentConversations, searchStorage, v1Store } from "@dembrane/conversations"; +import { newId } from "@dembrane/core"; +import { createDb, migrate } from "@dembrane/db"; +import { gatherTranscripts, popcornStore } from "@dembrane/popcorn"; +import { reportsStorage } from "@dembrane/reports"; +import postgres from "postgres"; + +/** + * Landscape gate canary test (Slice B). + * + * Seeds one project with a legacy conversation plus six gated conversations covering every + * lifecycle state (`pending`, `accepted` with null review, `held`, `host_rejected`, `rejected` + * with `deleted_at` set, and `entered` with `landscape_entered_at` set). Every conversation has + * distinct raw transcript, summary, participant name, and `landscape_text` canaries. + * + * Asserts that all six room producer sites (Map/analysis, Popcorn, Explore, and Canvas) emit only + * the legacy conversation's transcript/summary and the entered conversation's `landscape_text`, + * never the entered row's raw transcript, summary, replies, or participant name, and that private + * reads never surface the rejected row. + * + * Needs a scratch Postgres with pgvector: TEST_DATABASE_ADMIN_URL=postgres://u:p@host:5432/postgres + */ +const admin = process.env.TEST_DATABASE_ADMIN_URL; +const run = admin ? describe : describe.skip; +const dbName = `landscape_canary_${process.pid}`; + +const CANARY = { + legacy: { + id: "b0000000-0000-4000-8000-000000000001", + name: "CANARY_LEGACY_NAME", + transcript: "CANARY_LEGACY_TRANSCRIPT_9f1a", + summary: "CANARY_LEGACY_SUMMARY_9f1a", + }, + pending: { + id: "b0000000-0000-4000-8000-000000000002", + name: "CANARY_PENDING_NAME", + transcript: "CANARY_PENDING_TRANSCRIPT_2b3c", + summary: "CANARY_PENDING_SUMMARY_2b3c", + landscape: "CANARY_PENDING_LANDSCAPE_2b3c", + }, + acceptedUnreviewed: { + id: "b0000000-0000-4000-8000-000000000003", + name: "CANARY_ACCEPTED_UNREVIEWED_NAME", + transcript: "CANARY_ACCEPTED_UNREVIEWED_TRANSCRIPT_4d5e", + summary: "CANARY_ACCEPTED_UNREVIEWED_SUMMARY_4d5e", + landscape: "CANARY_ACCEPTED_UNREVIEWED_LANDSCAPE_4d5e", + }, + held: { + id: "b0000000-0000-4000-8000-000000000004", + name: "CANARY_HELD_NAME", + transcript: "CANARY_HELD_TRANSCRIPT_6f70", + summary: "CANARY_HELD_SUMMARY_6f70", + landscape: "CANARY_HELD_LANDSCAPE_6f70", + }, + hostRejected: { + id: "b0000000-0000-4000-8000-000000000005", + name: "CANARY_HOST_REJECTED_NAME", + transcript: "CANARY_HOST_REJECTED_TRANSCRIPT_8192", + summary: "CANARY_HOST_REJECTED_SUMMARY_8192", + landscape: "CANARY_HOST_REJECTED_LANDSCAPE_8192", + }, + rejected: { + id: "b0000000-0000-4000-8000-000000000006", + name: "CANARY_REJECTED_NAME", + transcript: "CANARY_REJECTED_TRANSCRIPT_a3b4", + summary: "CANARY_REJECTED_SUMMARY_a3b4", + landscape: "CANARY_REJECTED_LANDSCAPE_a3b4", + }, + entered: { + id: "b0000000-0000-4000-8000-000000000007", + name: "CANARY_ENTERED_NAME", + transcript: "CANARY_ENTERED_RAW_TRANSCRIPT_c5d6", + summary: "CANARY_ENTERED_RAW_SUMMARY_c5d6", + reply: "CANARY_ENTERED_REPLY_c5d6", + landscape: "CANARY_ENTERED_LANDSCAPE_c5d6", + }, +} as const; + +const FORBIDDEN_IN_ROOM = [ + CANARY.pending.name, + CANARY.pending.transcript, + CANARY.pending.summary, + CANARY.pending.landscape, + CANARY.acceptedUnreviewed.name, + CANARY.acceptedUnreviewed.transcript, + CANARY.acceptedUnreviewed.summary, + CANARY.acceptedUnreviewed.landscape, + CANARY.held.name, + CANARY.held.transcript, + CANARY.held.summary, + CANARY.held.landscape, + CANARY.hostRejected.name, + CANARY.hostRejected.transcript, + CANARY.hostRejected.summary, + CANARY.hostRejected.landscape, + CANARY.rejected.name, + CANARY.rejected.transcript, + CANARY.rejected.summary, + CANARY.rejected.landscape, + CANARY.entered.name, + CANARY.entered.transcript, + CANARY.entered.summary, + CANARY.entered.reply, +] as const; + +function assertNoForbiddenCanaries(payload: string) { + for (const forbidden of FORBIDDEN_IN_ROOM) { + expect(payload).not.toContain(forbidden); + } +} + +run("landscape gate canary across all five room producer sites", () => { + setDefaultTimeout(60_000); + let database: ReturnType; + let raw: postgres.Sql; + + const projectId = newId(); + const focalId = newId(); + const hostDirectusId = newId(); + const hostAppUserId = newId(); + + beforeAll(async () => { + const a = postgres(admin as string, { max: 1, onnotice: () => {} }); + await a.unsafe(`drop database if exists ${dbName} with (force)`); + await a.unsafe(`create database ${dbName}`); + await a.end(); + + const url = `${(admin as string).slice(0, (admin as string).lastIndexOf("/"))}/${dbName}`; + await migrate(url, { appEnv: "test" }); + database = createDb({ url, poolMax: 2 }); + raw = postgres(url, { max: 2, onnotice: () => {} }); + + await raw`insert into directus_users (id, email) values (${hostDirectusId}, 'host@example.com')`; + await raw`insert into app_user (id, directus_user_id) values (${hostAppUserId}, ${hostDirectusId})`; + await raw`insert into project (id, name, language, directus_user_id, is_conversation_allowed, + is_canvas_enabled, is_get_reply_enabled, is_get_reply_cross_pollination_enabled, + anonymize_transcripts, visibility) + values (${projectId}, 'Landscape Canary', 'en', ${hostDirectusId}, true, true, true, true, + false, 'workspace')`; + + const seed = async (row: { + id: string; + createdAt: string; + name: string; + summary: string; + transcript: string; + isFinished: boolean; + deletedAt: string | null; + status: string | null; + review: string | null; + landscapeText: string | null; + enteredAt: string | null; + }) => { + await raw`insert into conversation ( + id, project_id, participant_name, summary, created_at, updated_at, + is_finished, deleted_at, landscape_status, landscape_review, + landscape_text, landscape_entered_at + ) values ( + ${row.id}, ${projectId}, ${row.name}, ${row.summary}, ${row.createdAt}, ${row.createdAt}, + ${row.isFinished}, ${row.deletedAt}, ${row.status}, ${row.review}, + ${row.landscapeText}, ${row.enteredAt} + )`; + await raw`insert into conversation_chunk ( + id, conversation_id, transcript, raw_transcript, timestamp, created_at + ) values ( + ${newId()}, ${row.id}, ${row.transcript}, ${row.transcript}, ${row.createdAt}, ${row.createdAt} + )`; + }; + + await seed({ + id: CANARY.legacy.id, + createdAt: "2026-11-30T10:01:00Z", + name: CANARY.legacy.name, + summary: CANARY.legacy.summary, + transcript: CANARY.legacy.transcript, + isFinished: true, + deletedAt: null, + status: null, + review: null, + landscapeText: null, + enteredAt: null, + }); + await seed({ + id: CANARY.pending.id, + createdAt: "2026-11-30T10:02:00Z", + name: CANARY.pending.name, + summary: CANARY.pending.summary, + transcript: CANARY.pending.transcript, + isFinished: false, + deletedAt: null, + status: "pending", + review: null, + landscapeText: CANARY.pending.landscape, + enteredAt: null, + }); + await seed({ + id: CANARY.acceptedUnreviewed.id, + createdAt: "2026-11-30T10:03:00Z", + name: CANARY.acceptedUnreviewed.name, + summary: CANARY.acceptedUnreviewed.summary, + transcript: CANARY.acceptedUnreviewed.transcript, + isFinished: true, + deletedAt: null, + status: "accepted", + review: null, + landscapeText: CANARY.acceptedUnreviewed.landscape, + enteredAt: null, + }); + await seed({ + id: CANARY.held.id, + createdAt: "2026-11-30T10:04:00Z", + name: CANARY.held.name, + summary: CANARY.held.summary, + transcript: CANARY.held.transcript, + isFinished: true, + deletedAt: null, + status: "accepted", + review: "held", + landscapeText: CANARY.held.landscape, + enteredAt: null, + }); + await seed({ + id: CANARY.hostRejected.id, + createdAt: "2026-11-30T10:05:00Z", + name: CANARY.hostRejected.name, + summary: CANARY.hostRejected.summary, + transcript: CANARY.hostRejected.transcript, + isFinished: true, + deletedAt: null, + status: "accepted", + review: "host_rejected", + landscapeText: CANARY.hostRejected.landscape, + enteredAt: null, + }); + await seed({ + id: CANARY.rejected.id, + createdAt: "2026-11-30T10:06:00Z", + name: CANARY.rejected.name, + summary: CANARY.rejected.summary, + transcript: CANARY.rejected.transcript, + isFinished: true, + deletedAt: "2026-11-30T10:06:30Z", + status: "rejected", + review: null, + landscapeText: CANARY.rejected.landscape, + enteredAt: null, + }); + await seed({ + id: CANARY.entered.id, + createdAt: "2026-11-30T10:07:00Z", + name: CANARY.entered.name, + summary: CANARY.entered.summary, + transcript: CANARY.entered.transcript, + isFinished: true, + deletedAt: null, + status: "accepted", + review: "auto_approved", + landscapeText: CANARY.entered.landscape, + enteredAt: "2026-11-30T10:07:30Z", + }); + + await raw`insert into conversation_reply ( + id, conversation_id, reply, content_text, type, date_created + ) values ( + ${newId()}, ${CANARY.entered.id}, ${CANARY.entered.id}, + ${CANARY.entered.reply}, 'assistant_reply', '2026-11-30T10:07:10Z' + )`; + }); + + afterAll(async () => { + await raw?.end(); + await database?.close(); + const a = postgres(admin as string, { max: 1, onnotice: () => {} }); + await a.unsafe(`drop database if exists ${dbName} with (force)`); + await a.end(); + }); + + test("site 1 & 2: analysis loadTranscripts and countConversationsWithTranscripts", async () => { + const store = new AnalysisStore(raw); + const transcripts = await loadTranscripts(store, projectId); + expect(transcripts.map((t) => t.id)).toEqual([CANARY.legacy.id, CANARY.entered.id]); + expect(transcripts[0]?.label).toBe(CANARY.legacy.name); + expect(transcripts[0]?.text).toBe(CANARY.legacy.transcript); + expect(transcripts[1]?.label).toBe("Conversation 2"); + expect(transcripts[1]?.text).toBe(CANARY.entered.landscape); + assertNoForbiddenCanaries(JSON.stringify(transcripts)); + + const count = await countConversationsWithTranscripts(store, projectId); + expect(count).toBe(2); + }); + + test("site 3 & 4: popcorn transcripts(), gatherTranscripts(), and waitingConversations()", async () => { + const store = popcornStore(raw); + const rawResult = await store.transcripts(projectId); + expect(rawResult.conversations.map((c) => String(c.id))).toEqual([ + CANARY.legacy.id, + CANARY.entered.id, + ]); + assertNoForbiddenCanaries(JSON.stringify(rawResult)); + + const gathered = await gatherTranscripts(store, projectId); + expect(gathered.map((g) => g.id)).toEqual([CANARY.legacy.id, CANARY.entered.id]); + expect(gathered[0]?.label).toBe(CANARY.legacy.name); + expect(gathered[0]?.text).toBe(CANARY.legacy.transcript); + expect(gathered[1]?.label).toBe("Conversation 2"); + expect(gathered[1]?.text).toBe(CANARY.entered.landscape); + assertNoForbiddenCanaries(JSON.stringify(gathered)); + + const waiting = await store.waitingConversations(projectId); + expect(waiting.recording).toBe(0); + expect([...waiting.finished].sort()).toEqual([CANARY.legacy.id, CANARY.entered.id]); + }); + + test("site 5: Explore adjacentConversations and adjacentContent in summary and transcript modes", async () => { + const store = v1Store(database.db); + + const summaryBlock = await adjacentConversations(store, projectId, focalId, true); + expect(summaryBlock).toContain(CANARY.legacy.summary); + expect(summaryBlock).toContain(CANARY.entered.landscape); + assertNoForbiddenCanaries(summaryBlock); + + const transcriptBlock = await adjacentConversations(store, projectId, focalId, false); + expect(transcriptBlock).toContain(CANARY.legacy.transcript); + expect(transcriptBlock).toContain(CANARY.entered.landscape); + assertNoForbiddenCanaries(transcriptBlock); + + const legacyContent = await store.adjacentContent(CANARY.legacy.id); + expect(legacyContent.chunks.map((c) => c.transcript)).toEqual([CANARY.legacy.transcript]); + + const enteredContent = await store.adjacentContent(CANARY.entered.id); + expect(enteredContent.chunks.map((c) => c.transcript)).toEqual([CANARY.entered.landscape]); + expect(enteredContent.replies).toEqual([]); + assertNoForbiddenCanaries(JSON.stringify(enteredContent)); + + for (const blockedId of [ + CANARY.pending.id, + CANARY.acceptedUnreviewed.id, + CANARY.held.id, + CANARY.hostRejected.id, + CANARY.rejected.id, + ]) { + expect(await store.adjacentContent(blockedId)).toEqual({ chunks: [], replies: [] }); + } + }); + + test("site 6: Canvas gatherConversations, gatherChunks, and executeGatherSpec", async () => { + const store = canvasStore(raw); + const convs = await store.gatherConversations(projectId, [], []); + expect(convs.map((c) => String(c.id))).toEqual([CANARY.entered.id, CANARY.legacy.id]); + expect(convs[0]?.participant_name).toBeNull(); + expect(convs[1]?.participant_name).toBe(CANARY.legacy.name); + assertNoForbiddenCanaries(JSON.stringify(convs)); + + const legacyChunks = await store.gatherChunks(CANARY.legacy.id, null); + expect(legacyChunks.map((c) => c.transcript)).toEqual([CANARY.legacy.transcript]); + + const enteredChunks = await store.gatherChunks(CANARY.entered.id, null); + expect(enteredChunks.map((c) => c.transcript)).toEqual([CANARY.entered.landscape]); + assertNoForbiddenCanaries(JSON.stringify(enteredChunks)); + + expect(await store.gatherChunks(CANARY.entered.id, "2026-11-30T10:08:00Z")).toEqual([]); + expect( + (await store.gatherChunks(CANARY.entered.id, "2026-11-30T10:07:00Z")).map( + (c) => c.transcript, + ), + ).toEqual([CANARY.entered.landscape]); + + for (const blockedId of [ + CANARY.pending.id, + CANARY.acceptedUnreviewed.id, + CANARY.held.id, + CANARY.hostRejected.id, + CANARY.rejected.id, + ]) { + expect(await store.gatherChunks(blockedId, null)).toEqual([]); + } + + const bundle = await executeGatherSpec( + { store, accessStore: new DrizzleAccessStore(database.db) }, + { + projectId, + actingUser: hostDirectusId, + gatherSpec: {}, + fullHistory: true, + }, + ); + const gathered = bundle.conversations as Record[]; + expect(gathered.map((c) => c.id)).toEqual([CANARY.entered.id, CANARY.legacy.id]); + expect(gathered[0]?.label).toBe("participant"); + expect(gathered[0]?.latest_transcript).toBe(CANARY.entered.landscape); + expect(gathered[1]?.label).toBe(CANARY.legacy.name); + expect(gathered[1]?.latest_transcript).toBe(CANARY.legacy.transcript); + assertNoForbiddenCanaries(JSON.stringify(bundle)); + }); + + test("private reads never surface rejected (deleted_at set) canaries", async () => { + const chats = chatReads(database.db); + const chatList = await chats.listWithFilters({ projectId, limit: 100 }); + expect(chatList.map((r) => String(r.id))).not.toContain(CANARY.rejected.id); + expect(await chats.liveConversation(CANARY.rejected.id)).toBeNull(); + + const reports = reportsStorage(database.db); + const reportConvs = await reports.conversationsForReport(projectId); + expect(reportConvs.map((r) => String(r.id))).not.toContain(CANARY.rejected.id); + const reportLive = await reports.liveConversations(projectId); + expect(reportLive.map((r) => String(r.id))).not.toContain(CANARY.rejected.id); + + const search = searchStorage(database.db); + const who = { appUserId: hostAppUserId, directusUserId: hostDirectusId }; + expect(await search.conversations(CANARY.rejected.summary, 20)).toEqual([]); + expect(await search.chunks(CANARY.rejected.transcript, 20, who)).toEqual([]); + }); + + test("host-private search still finds gated conversations that are not deleted", async () => { + const search = searchStorage(database.db); + const who = { appUserId: hostAppUserId, directusUserId: hostDirectusId }; + for (const c of [CANARY.pending, CANARY.held, CANARY.hostRejected]) { + const convs = await search.conversations(c.summary, 20); + expect(convs.map((r) => String(r.id))).toEqual([c.id]); + const chunks = await search.chunks(c.transcript, 20, who); + expect(chunks.map((r) => String(r.conversation_id))).toEqual([c.id]); + } + }); + + test("database check constraints block invalid landscape states and unreviewed entry", async () => { + // Wrap postgres.js lazy PendingQuery in a native Promise: Bun's expect(p).rejects + // inspects internal Promise slots without invoking custom .then(), which otherwise hangs. + const runQuery = async (query: PromiseLike): Promise => await query; + + await expect( + runQuery( + raw`insert into conversation (id, project_id, landscape_status) + values (${newId()}, ${projectId}, 'invalid')`, + ), + ).rejects.toThrow(); + + await expect( + runQuery( + raw`insert into conversation (id, project_id, landscape_review) + values (${newId()}, ${projectId}, 'invalid')`, + ), + ).rejects.toThrow(); + + // landscape_entered_at requires accepted + auto_approved|host_approved + non-null landscape_text. + await expect( + runQuery( + raw`insert into conversation ( + id, project_id, landscape_status, landscape_review, landscape_text, landscape_entered_at + ) values (${newId()}, ${projectId}, 'pending', 'auto_approved', 'text', now())`, + ), + ).rejects.toThrow(); + + await expect( + runQuery( + raw`insert into conversation ( + id, project_id, landscape_status, landscape_review, landscape_text, landscape_entered_at + ) values (${newId()}, ${projectId}, 'accepted', 'held', 'text', now())`, + ), + ).rejects.toThrow(); + + await expect( + runQuery( + raw`insert into conversation ( + id, project_id, landscape_status, landscape_review, landscape_text, landscape_entered_at + ) values (${newId()}, ${projectId}, 'accepted', 'auto_approved', null, now())`, + ), + ).rejects.toThrow(); + + // Valid host_approved entry succeeds. + const hostApprovedId = newId(); + await raw`insert into conversation ( + id, project_id, landscape_status, landscape_review, landscape_text, landscape_entered_at + ) values (${hostApprovedId}, ${projectId}, 'accepted', 'host_approved', 'Host approved text', now())`; + await raw`delete from conversation where id = ${hostApprovedId}`; + }); +}); diff --git a/dembrane/platform/packages/analysis/src/index.ts b/dembrane/platform/packages/analysis/src/index.ts index 54fdb60ad..08265e060 100644 --- a/dembrane/platform/packages/analysis/src/index.ts +++ b/dembrane/platform/packages/analysis/src/index.ts @@ -24,6 +24,7 @@ export * as popcornShared from "./popcorn-shared"; export { ASSESSMENT_RECIPE_ID, countConversationsWithTranscripts, + loadTranscripts, POPCORN_SOURCES_KEY, POPCORN_TENSIONS_SOURCES_KEY, type PopcornSources, diff --git a/dembrane/platform/packages/analysis/src/recipes/services.ts b/dembrane/platform/packages/analysis/src/recipes/services.ts index 6c4f81b4d..9e828e088 100644 --- a/dembrane/platform/packages/analysis/src/recipes/services.ts +++ b/dembrane/platform/packages/analysis/src/recipes/services.ts @@ -1,3 +1,4 @@ +import { inRoomSql, usesAcceptedText } from "@dembrane/db"; import { isoTimestamp } from "@dembrane/legacy-shape"; import type { Completer, CompletionRequest, Embedder } from "@dembrane/llm"; import type { Json } from "../contracts"; @@ -52,35 +53,44 @@ export async function loadTranscripts( const conversations = await q<{ id: string; participant_name: string | null; - created_at: string | null; + created_at: string | Date | null; + landscape_status: string | null; + landscape_text: string | null; }>( store.sql, - `SELECT id::text AS id, participant_name, created_at FROM conversation - WHERE project_id = $1 AND deleted_at IS NULL + `SELECT id::text AS id, participant_name, created_at, landscape_status, landscape_text + FROM conversation + WHERE project_id = $1 AND deleted_at IS NULL AND ${inRoomSql("conversation")} ORDER BY created_at, id`, [projectId], ); if (!conversations.length) return []; - const chunks = await q<{ conversation_id: string; transcript: string | null }>( - store.sql, - `SELECT conversation_id::text AS conversation_id, transcript FROM conversation_chunk - WHERE conversation_id = ANY($1::uuid[]) AND transcript IS NOT NULL - ORDER BY timestamp, created_at, id`, - [conversations.map((c) => c.id)], - ); + const ungatedIds = conversations.filter((c) => !usesAcceptedText(c)).map((c) => c.id); const texts = new Map(); - for (const chunk of chunks) { - const text = String(chunk.transcript ?? "").trim(); - if (!text) continue; - const list = texts.get(chunk.conversation_id) ?? []; - list.push(text); - texts.set(chunk.conversation_id, list); + if (ungatedIds.length) { + const chunks = await q<{ conversation_id: string; transcript: string | null }>( + store.sql, + `SELECT conversation_id::text AS conversation_id, transcript FROM conversation_chunk + WHERE conversation_id = ANY($1::uuid[]) AND transcript IS NOT NULL + ORDER BY timestamp, created_at, id`, + [ungatedIds], + ); + for (const chunk of chunks) { + const text = String(chunk.transcript ?? "").trim(); + if (!text) continue; + const list = texts.get(chunk.conversation_id) ?? []; + list.push(text); + texts.set(chunk.conversation_id, list); + } } const out: Transcript[] = []; conversations.forEach((c, i) => { - const text = (texts.get(c.id) ?? []).join("\n").trim(); + const gated = usesAcceptedText(c); + const text = gated + ? String(c.landscape_text ?? "").trim() + : (texts.get(c.id) ?? []).join("\n").trim(); if (!text) return; - const name = String(c.participant_name ?? "").trim(); + const name = gated ? "" : String(c.participant_name ?? "").trim(); out.push({ id: c.id, label: name || `Conversation ${i + 1}`, @@ -99,10 +109,17 @@ export async function countConversationsWithTranscripts( ): Promise { const rows = await q<{ n: string }>( store.sql, - `SELECT count(DISTINCT ch.conversation_id) AS n - FROM conversation_chunk AS ch JOIN conversation AS c ON c.id = ch.conversation_id - WHERE c.project_id = $1 AND c.deleted_at IS NULL - AND ch.transcript IS NOT NULL AND ch.transcript <> ''`, + `SELECT count(*)::int AS n + FROM conversation AS c + WHERE c.project_id = $1 AND c.deleted_at IS NULL AND ${inRoomSql("c")} + AND ( + (c.landscape_status IS NULL AND EXISTS ( + SELECT 1 FROM conversation_chunk AS ch + WHERE ch.conversation_id = c.id + AND ch.transcript IS NOT NULL AND ch.transcript <> '' + )) + OR (c.landscape_status IS NOT NULL AND btrim(coalesce(c.landscape_text, '')) <> '') + )`, [projectId], ); return Number(rows[0]?.n ?? 0); diff --git a/dembrane/platform/packages/analysis/test/load-transcripts.test.ts b/dembrane/platform/packages/analysis/test/load-transcripts.test.ts new file mode 100644 index 000000000..e9bfc975e --- /dev/null +++ b/dembrane/platform/packages/analysis/test/load-transcripts.test.ts @@ -0,0 +1,79 @@ +import { describe, expect, test } from "bun:test"; +import { loadTranscripts } from "../src/recipes/services"; +import type { AnalysisStore } from "../src/store"; + +function fakeStore(results: readonly unknown[][]): AnalysisStore { + let i = 0; + return { + sql: { + unsafe: async () => results[i++] ?? [], + }, + } as unknown as AnalysisStore; +} + +describe("loadTranscripts", () => { + test("handles both Date instances and Postgres timestamp strings for created_at", async () => { + const legacyId = "b0000000-0000-4000-8000-000000000001"; + const enteredId = "b0000000-0000-4000-8000-000000000002"; + const store = fakeStore([ + [ + { + id: legacyId, + participant_name: "Ada", + created_at: new Date("2026-11-30T10:01:00.000Z"), + landscape_status: null, + landscape_text: null, + }, + { + id: enteredId, + participant_name: "Hidden Name", + created_at: "2026-11-30 10:07:00+00", + landscape_status: "accepted", + landscape_text: "Accepted landscape text", + }, + ], + [{ conversation_id: legacyId, transcript: "Legacy chunk transcript" }], + ]); + + const transcripts = await loadTranscripts(store, "p0000000-0000-4000-8000-000000000001"); + expect(transcripts).toEqual([ + { + id: legacyId, + label: "Ada", + createdAt: "2026-11-30T10:01:00.000Z", + text: "Legacy chunk transcript", + }, + { + id: enteredId, + label: "Conversation 2", + createdAt: "2026-11-30T10:07:00.000Z", + text: "Accepted landscape text", + }, + ]); + }); + + test("returns null createdAt for null or invalid Date values", async () => { + const id = "b0000000-0000-4000-8000-000000000003"; + const store = fakeStore([ + [ + { + id, + participant_name: null, + created_at: new Date("invalid"), + landscape_status: "accepted", + landscape_text: "Valid accepted text", + }, + ], + ]); + + const transcripts = await loadTranscripts(store, "p0000000-0000-4000-8000-000000000001"); + expect(transcripts).toEqual([ + { + id, + label: "Conversation 1", + createdAt: null, + text: "Valid accepted text", + }, + ]); + }); +}); diff --git a/dembrane/platform/packages/canvas/src/index.ts b/dembrane/platform/packages/canvas/src/index.ts index 08d6a9b5f..e5380c3ac 100644 --- a/dembrane/platform/packages/canvas/src/index.ts +++ b/dembrane/platform/packages/canvas/src/index.ts @@ -1,2 +1,4 @@ +export { executeGatherSpec, type GatherDeps } from "./gather"; export { type CanvasWorkerDeps, canvasApiJobs, canvasTick, canvasWorker } from "./jobs"; export { type CanvasRoutesDeps, canvasRoutes } from "./routes"; +export { type CanvasStore, canvasStore } from "./storage"; diff --git a/dembrane/platform/packages/canvas/src/storage.ts b/dembrane/platform/packages/canvas/src/storage.ts index 21136583a..dcd36f1b0 100644 --- a/dembrane/platform/packages/canvas/src/storage.ts +++ b/dembrane/platform/packages/canvas/src/storage.ts @@ -1,5 +1,6 @@ import { newId } from "@dembrane/core"; -import type { Db } from "@dembrane/db"; +import { type Db, inRoomSql, usesAcceptedText } from "@dembrane/db"; +import { isoTimestamp } from "@dembrane/legacy-shape"; import type postgres from "postgres"; import type { Json } from "./py"; @@ -294,8 +295,12 @@ export function canvasStore(sql: Sql) { const tags = tagIds.filter(isUuid); if (conversationIds.length && !ids.length) return []; if (tagIds.length && !tags.length) return []; - return sql`select c.id, c.participant_name, c.created_at from conversation c + return sql`select c.id, + case when c.landscape_status is null then c.participant_name else null end as participant_name, + c.created_at, c.landscape_status, c.landscape_text, c.landscape_entered_at + from conversation c where c.project_id = ${projectId} and c.deleted_at is null + and ${sql.unsafe(inRoomSql("c"))} ${ids.length ? sql`and c.id = any(${ids}::uuid[])` : sql``} ${ tags.length @@ -307,10 +312,40 @@ export function canvasStore(sql: Sql) { }, async gatherChunks(conversationId: string, since: string | null): Promise { - return sql`select id, transcript, created_at, timestamp from conversation_chunk - where conversation_id = ${conversationId} and transcript is not null - ${since ? sql`and created_at >= ${since}` : sql``} - order by timestamp asc, created_at asc limit 1500`; + const [conv] = + await sql`select id, created_at, landscape_status, landscape_text, landscape_entered_at + from conversation + where id = ${conversationId} and deleted_at is null + and ${sql.unsafe(inRoomSql("conversation"))} + limit 1`; + if (!conv) return []; + if ( + usesAcceptedText({ landscape_status: (conv.landscape_status as string | null) ?? null }) + ) { + const text = typeof conv.landscape_text === "string" ? conv.landscape_text.trim() : ""; + if (!text) return []; + const at = (conv.landscape_entered_at ?? conv.created_at) as string | Date | null; + const atIso = isoTimestamp(at); + if (since && atIso && Date.parse(atIso) < Date.parse(since)) return []; + return [ + { + id: conv.id, + transcript: conv.landscape_text, + created_at: at, + timestamp: at, + }, + ]; + } + return sql`select ch.id, ch.transcript, ch.created_at, ch.timestamp + from conversation_chunk ch + join conversation c on c.id = ch.conversation_id + where ch.conversation_id = ${conversationId} + and c.deleted_at is null + and ${sql.unsafe(inRoomSql("c"))} + and c.landscape_status is null + and ch.transcript is not null + ${since ? sql`and ch.created_at >= ${since}` : sql``} + order by ch.timestamp asc, ch.created_at asc limit 1500`; }, // ── history reads ──────────────────────────────────────────────── diff --git a/dembrane/platform/packages/conversations/src/index.ts b/dembrane/platform/packages/conversations/src/index.ts index 66866be55..1ce209150 100644 --- a/dembrane/platform/packages/conversations/src/index.ts +++ b/dembrane/platform/packages/conversations/src/index.ts @@ -33,6 +33,7 @@ export { conversationWorker } from "./pipeline/worker"; export { pipelineWorkflows, RETRIES, type RetryPolicy } from "./pipeline/workflows"; export { requirePortalAi } from "./portal-ai"; export { conversationRoutes } from "./routes"; +export { searchStorage } from "./search/storage"; export { type ChunkRow, type ConversationRow, @@ -43,11 +44,14 @@ export { transaction, } from "./storage"; export { + adjacentConversations, ContentPolicyError, CURRENT_CONVERSATION_NAME, formatConversation, OTHER_CONVERSATION_NAME, type ReplyProject, replyPrompt, + replyProtocol, sampleReply, } from "./v1/reply"; +export { type V1Store, v1Store } from "./v1/storage"; diff --git a/dembrane/platform/packages/conversations/src/search/storage.ts b/dembrane/platform/packages/conversations/src/search/storage.ts index 94f257c35..60d1b0d40 100644 --- a/dembrane/platform/packages/conversations/src/search/storage.ts +++ b/dembrane/platform/packages/conversations/src/search/storage.ts @@ -40,7 +40,7 @@ async function reachableConversations(db: Db, who: Searcher): Promise const rows = await db.execute<{ id: string }>(sql` select c.id from conversation c join project p on p.id = c.project_id - where p.deleted_at is null and ( + where p.deleted_at is null and c.deleted_at is null and ( p.workspace_id in ( select wm.workspace_id from workspace_membership wm where wm.user_id = ${who.appUserId} and wm.deleted_at is null) diff --git a/dembrane/platform/packages/conversations/src/v1/reply.ts b/dembrane/platform/packages/conversations/src/v1/reply.ts index 22c3c5e40..c9a14a873 100644 --- a/dembrane/platform/packages/conversations/src/v1/reply.ts +++ b/dembrane/platform/packages/conversations/src/v1/reply.ts @@ -1,4 +1,5 @@ import { contextForPrompt } from "@dembrane/core"; +import { usesAcceptedText } from "@dembrane/db"; import { isoTimestamp } from "@dembrane/legacy-shape"; import { type Models, modelErrorShape, speechHint } from "@dembrane/llm"; import { renderPrompt } from "@dembrane/prompts"; @@ -64,7 +65,7 @@ export const CURRENT_CONVERSATION_NAME = "this conversation"; export const OTHER_CONVERSATION_NAME = "another group"; /** The project's other conversations, as Explore may read them when cross-pollination is on. */ -async function adjacentConversations( +export async function adjacentConversations( store: V1Store, projectId: string, excludeId: string, @@ -75,6 +76,26 @@ async function adjacentConversations( const tagsOf = (id: string) => (tags.get(id) ?? []).filter((t): t is string => t !== null); const candidates: [string, number][] = []; for (const row of rows) { + if (usesAcceptedText(row)) { + const text = row.landscape_text?.trim(); + if (!text) continue; + const c: Conv = { + name: OTHER_CONVERSATION_NAME, + tags: tagsOf(row.id), + transcript: text, + }; + let f = formatConversation(c); + let tokens = countTokens(f); + if (!useSummaries && tokens > TARGET_TOKENS_PER_CONV) { + const ratio = TARGET_TOKENS_PER_CONV / tokens; + const chars = [...c.transcript]; + c.transcript = `${chars.slice(0, Math.trunc(chars.length * ratio)).join("")}\n[Truncated for brevity...]`; + f = formatConversation(c); + tokens = countTokens(f); + } + candidates.push([f, tokens]); + continue; + } if (useSummaries) { if (row.summary === null) continue; const f = formatConversation({ diff --git a/dembrane/platform/packages/conversations/src/v1/storage.ts b/dembrane/platform/packages/conversations/src/v1/storage.ts index 47e8be11c..78b8b0203 100644 --- a/dembrane/platform/packages/conversations/src/v1/storage.ts +++ b/dembrane/platform/packages/conversations/src/v1/storage.ts @@ -1,6 +1,5 @@ import { newId } from "@dembrane/core"; -import type { Db } from "@dembrane/db"; -import { schema } from "@dembrane/db"; +import { type Db, inRoomSql, schema, usesAcceptedText } from "@dembrane/db"; import { and, asc, desc, eq, inArray, isNotNull, isNull, ne, sql } from "drizzle-orm"; import { isUuid } from "../storage"; @@ -221,8 +220,14 @@ export function v1Store(db: Db) { return db .select({ id: conversation.id, - participant_name: conversation.participant_name, - summary: conversation.summary, + participant_name: sql< + string | null + >`CASE WHEN ${conversation.landscape_status} IS NULL THEN ${conversation.participant_name} ELSE NULL END`, + summary: sql< + string | null + >`CASE WHEN ${conversation.landscape_status} IS NULL THEN ${conversation.summary} ELSE ${conversation.landscape_text} END`, + landscape_status: conversation.landscape_status, + landscape_text: conversation.landscape_text, }) .from(conversation) .where( @@ -230,6 +235,7 @@ export function v1Store(db: Db) { eq(conversation.project_id, projectId), ne(conversation.id, excludeId), isNull(conversation.deleted_at), + sql.raw(inRoomSql("conversation")), ), ) .orderBy(asc(conversation.id)) @@ -238,6 +244,29 @@ export function v1Store(db: Db) { /** Latest chunks and replies of adjacent conversations, newest first (deep sort). */ async adjacentContent(conversationId: string) { + const [conv] = await db + .select({ + created_at: conversation.created_at, + landscape_status: conversation.landscape_status, + landscape_text: conversation.landscape_text, + }) + .from(conversation) + .where( + and( + eq(conversation.id, conversationId), + isNull(conversation.deleted_at), + sql.raw(inRoomSql("conversation")), + ), + ) + .limit(1); + if (!conv) return { chunks: [], replies: [] }; + if (usesAcceptedText(conv)) { + const text = conv.landscape_text?.trim() ? conv.landscape_text : null; + return { + chunks: text !== null ? [{ timestamp: conv.created_at, transcript: text }] : [], + replies: [], + }; + } const [chunks, replies] = await Promise.all([ db .select({ diff --git a/dembrane/platform/packages/db/migrations/0064_expand_conversation_landscape.sql b/dembrane/platform/packages/db/migrations/0064_expand_conversation_landscape.sql new file mode 100644 index 000000000..443cc0803 --- /dev/null +++ b/dembrane/platform/packages/db/migrations/0064_expand_conversation_landscape.sql @@ -0,0 +1,24 @@ +-- Landscape gate columns and check constraints on conversation. Safe to run twice. +-- All eight columns are nullable with no default (no table rewrite); constraints are added +-- NOT VALID so the hot conversation table is not scanned under lock. +ALTER TABLE "conversation" + ADD COLUMN IF NOT EXISTS "landscape_status" varchar(16), + ADD COLUMN IF NOT EXISTS "landscape_review" varchar(16), + ADD COLUMN IF NOT EXISTS "landscape_text" text, + ADD COLUMN IF NOT EXISTS "landscape_text_hash" varchar(64), + ADD COLUMN IF NOT EXISTS "landscape_consent_version" varchar(32), + ADD COLUMN IF NOT EXISTS "landscape_decided_at" timestamp with time zone, + ADD COLUMN IF NOT EXISTS "landscape_moderation" jsonb, + ADD COLUMN IF NOT EXISTS "landscape_entered_at" timestamp with time zone;--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "conversation" ADD CONSTRAINT "conversation_landscape_status" CHECK ("conversation"."landscape_status" in ('pending', 'accepted', 'rejected')) NOT VALID; +EXCEPTION WHEN duplicate_object THEN NULL; +END $$;--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "conversation" ADD CONSTRAINT "conversation_landscape_review" CHECK ("conversation"."landscape_review" in ('auto_approved', 'held', 'host_approved', 'host_rejected')) NOT VALID; +EXCEPTION WHEN duplicate_object THEN NULL; +END $$;--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "conversation" ADD CONSTRAINT "conversation_landscape_entry" CHECK ("conversation"."landscape_entered_at" is null or (coalesce("conversation"."landscape_status", '') = 'accepted' and coalesce("conversation"."landscape_review", '') in ('auto_approved', 'host_approved') and "conversation"."landscape_text" is not null)) NOT VALID; +EXCEPTION WHEN duplicate_object THEN NULL; +END $$; diff --git a/dembrane/platform/packages/db/migrations/meta/0064_snapshot.json b/dembrane/platform/packages/db/migrations/meta/0064_snapshot.json new file mode 100644 index 000000000..a59955e7d --- /dev/null +++ b/dembrane/platform/packages/db/migrations/meta/0064_snapshot.json @@ -0,0 +1,18161 @@ +{ + "id": "0167b889-835c-4294-a91e-ecad65f08e35", + "prevId": "caaac425-d323-48fe-84bd-359417375546", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.access_request": { + "name": "access_request", + "schema": "", + "columns": { + "actioned_at": { + "name": "actioned_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "actioned_by": { + "name": "actioned_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "requested_at": { + "name": "requested_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "access_request_actioned_by_foreign": { + "name": "access_request_actioned_by_foreign", + "tableFrom": "access_request", + "tableTo": "app_user", + "columnsFrom": [ + "actioned_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "access_request_user_id_foreign": { + "name": "access_request_user_id_foreign", + "tableFrom": "access_request", + "tableTo": "app_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "access_request_workspace_id_foreign": { + "name": "access_request_workspace_id_foreign", + "tableFrom": "access_request", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_audit_event": { + "name": "agent_audit_event", + "schema": "", + "columns": { + "app_user_id": { + "name": "app_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "grant_id": { + "name": "grant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "params": { + "name": "params", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "tool": { + "name": "tool", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": { + "agent_audit_event_app_user_id_index": { + "name": "agent_audit_event_app_user_id_index", + "columns": [ + { + "expression": "app_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_audit_event_client_id_index": { + "name": "agent_audit_event_client_id_index", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_audit_event_created_at_index": { + "name": "agent_audit_event_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_audit_event_grant_id_index": { + "name": "agent_audit_event_grant_id_index", + "columns": [ + { + "expression": "grant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_audit_event_org_id_index": { + "name": "agent_audit_event_org_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_audit_event_tool_index": { + "name": "agent_audit_event_tool_index", + "columns": [ + { + "expression": "tool", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_client": { + "name": "agent_client", + "schema": "", + "columns": { + "client_name": { + "name": "client_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "client_secret_encrypted": { + "name": "client_secret_encrypted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "token_endpoint_auth_method": { + "name": "token_endpoint_auth_method", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_grant": { + "name": "agent_grant", + "schema": "", + "columns": { + "app_user_id": { + "name": "app_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "client_id": { + "name": "client_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "client_name": { + "name": "client_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "consent_accepted_at": { + "name": "consent_accepted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "consent_version": { + "name": "consent_version", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "org_ids": { + "name": "org_ids", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "scopes": { + "name": "scopes", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "agent_grant_app_user_id_index": { + "name": "agent_grant_app_user_id_index", + "columns": [ + { + "expression": "app_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_grant_client_id_index": { + "name": "agent_grant_client_id_index", + "columns": [ + { + "expression": "client_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_grant_directus_user_id_index": { + "name": "agent_grant_directus_user_id_index", + "columns": [ + { + "expression": "directus_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_grant_expires_at_index": { + "name": "agent_grant_expires_at_index", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_grant_revoked_at_index": { + "name": "agent_grant_revoked_at_index", + "columns": [ + { + "expression": "revoked_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_insight": { + "name": "agent_insight", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "suggested_capability": { + "name": "suggested_capability", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "chat_id": { + "name": "chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "message_id": { + "name": "message_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'new'" + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_loop": { + "name": "agent_loop", + "schema": "", + "columns": { + "acting_directus_user_id": { + "name": "acting_directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "cadence_minutes": { + "name": "cadence_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 5 + }, + "caps": { + "name": "caps", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "chat_id": { + "name": "chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_from_chat_id": { + "name": "created_from_chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "report_id": { + "name": "report_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "popcorn_state": { + "name": "popcorn_state", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "agent_loop_project_id_foreign": { + "name": "agent_loop_project_id_foreign", + "tableFrom": "agent_loop", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "agent_loop_report_id_foreign": { + "name": "agent_loop_report_id_foreign", + "tableFrom": "agent_loop", + "tableTo": "project_report", + "columnsFrom": [ + "report_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_loop_run": { + "name": "agent_loop_run", + "schema": "", + "columns": { + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "free_period_start": { + "name": "free_period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "free_account_id": { + "name": "free_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "generation_id": { + "name": "generation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "loop_id": { + "name": "loop_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "agent_loop_run_running_started": { + "name": "agent_loop_run_running_started", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'running'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_loop_run_loop_started": { + "name": "agent_loop_run_loop_started", + "columns": [ + { + "expression": "loop_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "agent_loop_run_generation_id_foreign": { + "name": "agent_loop_run_generation_id_foreign", + "tableFrom": "agent_loop_run", + "tableTo": "canvas_generation", + "columnsFrom": [ + "generation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "agent_loop_run_loop_id_foreign": { + "name": "agent_loop_run_loop_id_foreign", + "tableFrom": "agent_loop_run", + "tableTo": "agent_loop", + "columnsFrom": [ + "loop_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_memory": { + "name": "agent_memory", + "schema": "", + "columns": { + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "memory_key": { + "name": "memory_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'project'" + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'agent'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.agent_token": { + "name": "agent_token", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "grant_id": { + "name": "grant_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "pair_id": { + "name": "pair_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "token_hash": { + "name": "token_hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": { + "agent_token_expires_at_index": { + "name": "agent_token_expires_at_index", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_token_grant_id_index": { + "name": "agent_token_grant_id_index", + "columns": [ + { + "expression": "grant_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_token_pair_id_index": { + "name": "agent_token_pair_id_index", + "columns": [ + { + "expression": "pair_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_token_revoked_at_index": { + "name": "agent_token_revoked_at_index", + "columns": [ + { + "expression": "revoked_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "agent_token_token_hash_index": { + "name": "agent_token_token_hash_index", + "columns": [ + { + "expression": "token_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "agent_token_token_hash_unique": { + "name": "agent_token_token_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "token_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.analysis_feedback": { + "name": "analysis_feedback", + "schema": "", + "columns": { + "actor_id": { + "name": "actor_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "object_id": { + "name": "object_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "rating": { + "name": "rating", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "revision_id": { + "name": "revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tags": { + "name": "tags", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "analysis_feedback_project_object_actor": { + "name": "analysis_feedback_project_object_actor", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "object_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_feedback_object_id_foreign": { + "name": "analysis_feedback_object_id_foreign", + "tableFrom": "analysis_feedback", + "tableTo": "analysis_object", + "columnsFrom": [ + "object_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_feedback_project_id_foreign": { + "name": "analysis_feedback_project_id_foreign", + "tableFrom": "analysis_feedback", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_feedback_revision_id_foreign": { + "name": "analysis_feedback_revision_id_foreign", + "tableFrom": "analysis_feedback", + "tableTo": "analysis_object_revision", + "columnsFrom": [ + "revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_feedback_actor_present": { + "name": "analysis_feedback_actor_present", + "value": "length(btrim((actor_id)::text)) > 0" + }, + "analysis_feedback_note_length": { + "name": "analysis_feedback_note_length", + "value": "(note IS NULL) OR (length(note) <= 500)" + }, + "analysis_feedback_rating_valid": { + "name": "analysis_feedback_rating_valid", + "value": "(rating)::text = ANY (ARRAY[('up'::character varying)::text, ('down'::character varying)::text])" + }, + "analysis_feedback_tags_are_an_array": { + "name": "analysis_feedback_tags_are_an_array", + "value": "json_typeof(tags) = 'array'::text" + } + }, + "isRLSEnabled": false + }, + "public.analysis_last_opened": { + "name": "analysis_last_opened", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "opened_at": { + "name": "opened_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": { + "analysis_last_opened_project_user": { + "name": "analysis_last_opened_project_user", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_last_opened_project_id_foreign": { + "name": "analysis_last_opened_project_id_foreign", + "tableFrom": "analysis_last_opened", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_last_opened_user_present": { + "name": "analysis_last_opened_user_present", + "value": "length(btrim((user_id)::text)) > 0" + } + }, + "isRLSEnabled": false + }, + "public.analysis_object": { + "name": "analysis_object", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "current_revision_id": { + "name": "current_revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "lineage_key": { + "name": "lineage_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "revision_count": { + "name": "revision_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "analysis_object_project_lineage": { + "name": "analysis_object_project_lineage", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lineage_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_object_current_revision_id_foreign": { + "name": "analysis_object_current_revision_id_foreign", + "tableFrom": "analysis_object", + "tableTo": "analysis_object_revision", + "columnsFrom": [ + "current_revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_object_project_id_foreign": { + "name": "analysis_object_project_id_foreign", + "tableFrom": "analysis_object", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_object_scope_id_foreign": { + "name": "analysis_object_scope_id_foreign", + "tableFrom": "analysis_object", + "tableTo": "analysis_scope", + "columnsFrom": [ + "scope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_object_revision_count_valid": { + "name": "analysis_object_revision_count_valid", + "value": "revision_count >= 0" + } + }, + "isRLSEnabled": false + }, + "public.analysis_object_revision": { + "name": "analysis_object_revision", + "schema": "", + "columns": { + "actor_id": { + "name": "actor_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "attributes": { + "name": "attributes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "content_hash": { + "name": "content_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "embedding_refs": { + "name": "embedding_refs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "hash_version": { + "name": "hash_version", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'c14n-v1'" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "object_id": { + "name": "object_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "origin": { + "name": "origin", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "parent_revision_id": { + "name": "parent_revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provenance": { + "name": "provenance", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "published_at": { + "name": "published_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "revision_number": { + "name": "revision_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "schema_version": { + "name": "schema_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "type": { + "name": "type", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "change_kind": { + "name": "change_kind", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "analysis_object_revision_object_number": { + "name": "analysis_object_revision_object_number", + "columns": [ + { + "expression": "object_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "revision_number", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_object_revision_one_staged_per_run": { + "name": "analysis_object_revision_one_staged_per_run", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "object_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((status)::text = ANY (ARRAY[('staged'::character varying)::text, ('candidate'::character varying)::text]))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_object_revision_run_status": { + "name": "analysis_object_revision_run_status", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_object_revision_object_id_foreign": { + "name": "analysis_object_revision_object_id_foreign", + "tableFrom": "analysis_object_revision", + "tableTo": "analysis_object", + "columnsFrom": [ + "object_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_object_revision_parent_revision_id_foreign": { + "name": "analysis_object_revision_parent_revision_id_foreign", + "tableFrom": "analysis_object_revision", + "tableTo": "analysis_object_revision", + "columnsFrom": [ + "parent_revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_object_revision_project_id_foreign": { + "name": "analysis_object_revision_project_id_foreign", + "tableFrom": "analysis_object_revision", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_object_revision_run_id_foreign": { + "name": "analysis_object_revision_run_id_foreign", + "tableFrom": "analysis_object_revision", + "tableTo": "analysis_run", + "columnsFrom": [ + "run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_object_revision_change_kind_authored": { + "name": "analysis_object_revision_change_kind_authored", + "value": "(change_kind IS NULL) OR ((origin)::text = 'authored'::text)" + }, + "analysis_object_revision_change_kind_valid": { + "name": "analysis_object_revision_change_kind_valid", + "value": "(change_kind IS NULL) OR ((change_kind)::text = ANY (ARRAY[('typo'::character varying)::text, ('clarity'::character varying)::text, ('meaning'::character varying)::text, ('withdraw'::character varying)::text, ('restore'::character varying)::text, ('rollback'::character varying)::text]))" + }, + "analysis_object_revision_generated_provenance": { + "name": "analysis_object_revision_generated_provenance", + "value": "((origin)::text <> 'generated'::text) OR ((((provenance)::jsonb ->> 'runId'::text) IS NOT NULL) AND (((provenance)::jsonb ->> 'recipeId'::text) IS NOT NULL))" + }, + "analysis_object_revision_hash_version_valid": { + "name": "analysis_object_revision_hash_version_valid", + "value": "(hash_version)::text = 'c14n-v1'::text" + }, + "analysis_object_revision_numbers_valid": { + "name": "analysis_object_revision_numbers_valid", + "value": "(revision_number >= 1) AND (schema_version >= 1)" + }, + "analysis_object_revision_origin_valid": { + "name": "analysis_object_revision_origin_valid", + "value": "(origin)::text = ANY (ARRAY[('generated'::character varying)::text, ('authored'::character varying)::text, ('imported'::character varying)::text])" + }, + "analysis_object_revision_published_at": { + "name": "analysis_object_revision_published_at", + "value": "((status)::text <> 'published'::text) OR (published_at IS NOT NULL)" + }, + "analysis_object_revision_status_valid": { + "name": "analysis_object_revision_status_valid", + "value": "(status)::text = ANY (ARRAY[('staged'::character varying)::text, ('candidate'::character varying)::text, ('published'::character varying)::text, ('discarded'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.analysis_outbox": { + "name": "analysis_outbox", + "schema": "", + "columns": { + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "claim": { + "name": "claim", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "consumers": { + "name": "consumers", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "delivered_at": { + "name": "delivered_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "event_type": { + "name": "event_type", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "sequence": { + "name": "sequence", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "analysis_outbox_due": { + "name": "analysis_outbox_due", + "columns": [ + { + "expression": "next_attempt_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = ANY (ARRAY[('pending'::character varying)::text, ('dispatching'::character varying)::text]))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_outbox_scope_sequence": { + "name": "analysis_outbox_scope_sequence", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sequence", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_outbox_project_id_foreign": { + "name": "analysis_outbox_project_id_foreign", + "tableFrom": "analysis_outbox", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_outbox_run_id_foreign": { + "name": "analysis_outbox_run_id_foreign", + "tableFrom": "analysis_outbox", + "tableTo": "analysis_run", + "columnsFrom": [ + "run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_outbox_scope_id_foreign": { + "name": "analysis_outbox_scope_id_foreign", + "tableFrom": "analysis_outbox", + "tableTo": "analysis_scope", + "columnsFrom": [ + "scope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_outbox_snapshot_id_foreign": { + "name": "analysis_outbox_snapshot_id_foreign", + "tableFrom": "analysis_outbox", + "tableTo": "analysis_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_outbox_counters_valid": { + "name": "analysis_outbox_counters_valid", + "value": "(sequence >= 1) AND (attempts >= 0)" + }, + "analysis_outbox_status_valid": { + "name": "analysis_outbox_status_valid", + "value": "(status)::text = ANY (ARRAY[('pending'::character varying)::text, ('dispatching'::character varying)::text, ('delivered'::character varying)::text, ('dead'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.analysis_relation": { + "name": "analysis_relation", + "schema": "", + "columns": { + "attributes": { + "name": "attributes", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "basis": { + "name": "basis", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "content_hash": { + "name": "content_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "from_object_id": { + "name": "from_object_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "from_revision_id": { + "name": "from_revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "hash_version": { + "name": "hash_version", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'c14n-v1'" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provenance": { + "name": "provenance", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "published_at": { + "name": "published_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "to_object_id": { + "name": "to_object_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "to_revision_id": { + "name": "to_revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": { + "analysis_relation_one_staged_per_run": { + "name": "analysis_relation_one_staged_per_run", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "from_revision_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "to_revision_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((status)::text = 'staged'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_relation_published_from": { + "name": "analysis_relation_published_from", + "columns": [ + { + "expression": "from_revision_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'published'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_relation_published_to": { + "name": "analysis_relation_published_to", + "columns": [ + { + "expression": "to_revision_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "type", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'published'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_relation_run_status": { + "name": "analysis_relation_run_status", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_relation_from_object_id_foreign": { + "name": "analysis_relation_from_object_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "analysis_object", + "columnsFrom": [ + "from_object_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_relation_from_revision_id_foreign": { + "name": "analysis_relation_from_revision_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "analysis_object_revision", + "columnsFrom": [ + "from_revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_relation_project_id_foreign": { + "name": "analysis_relation_project_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_relation_run_id_foreign": { + "name": "analysis_relation_run_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "analysis_run", + "columnsFrom": [ + "run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_relation_to_object_id_foreign": { + "name": "analysis_relation_to_object_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "analysis_object", + "columnsFrom": [ + "to_object_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_relation_to_revision_id_foreign": { + "name": "analysis_relation_to_revision_id_foreign", + "tableFrom": "analysis_relation", + "tableTo": "analysis_object_revision", + "columnsFrom": [ + "to_revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_relation_basis_valid": { + "name": "analysis_relation_basis_valid", + "value": "(basis)::text = ANY (ARRAY[('extracted'::character varying)::text, ('inferred'::character varying)::text, ('authored'::character varying)::text])" + }, + "analysis_relation_hash_version_valid": { + "name": "analysis_relation_hash_version_valid", + "value": "(hash_version)::text = 'c14n-v1'::text" + }, + "analysis_relation_not_reflexive": { + "name": "analysis_relation_not_reflexive", + "value": "from_revision_id <> to_revision_id" + }, + "analysis_relation_status_valid": { + "name": "analysis_relation_status_valid", + "value": "(status)::text = ANY (ARRAY[('staged'::character varying)::text, ('published'::character varying)::text, ('discarded'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.analysis_request_key": { + "name": "analysis_request_key", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "mode": { + "name": "mode", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "analysis_request_key_project_key": { + "name": "analysis_request_key_project_key", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_request_key_run": { + "name": "analysis_request_key_run", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_request_key_project_id_foreign": { + "name": "analysis_request_key_project_id_foreign", + "tableFrom": "analysis_request_key", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_request_key_run_id_foreign": { + "name": "analysis_request_key_run_id_foreign", + "tableFrom": "analysis_request_key", + "tableTo": "analysis_run", + "columnsFrom": [ + "run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_request_key_scope_id_foreign": { + "name": "analysis_request_key_scope_id_foreign", + "tableFrom": "analysis_request_key", + "tableTo": "analysis_scope", + "columnsFrom": [ + "scope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_request_key_mode_valid": { + "name": "analysis_request_key_mode_valid", + "value": "(mode)::text = ANY (ARRAY[('refresh'::character varying)::text, ('regenerate'::character varying)::text, ('retry'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.analysis_run": { + "name": "analysis_run", + "schema": "", + "columns": { + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "checks": { + "name": "checks", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "context": { + "name": "context", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "definition": { + "name": "definition", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "depends_on": { + "name": "depends_on", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "epoch": { + "name": "epoch", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_ref": { + "name": "execution_ref", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "free_period_start": { + "name": "free_period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "free_account_id": { + "name": "free_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "hash_version": { + "name": "hash_version", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'c14n-v1'" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "idempotency_key": { + "name": "idempotency_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "input_fingerprint": { + "name": "input_fingerprint", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "input_manifest": { + "name": "input_manifest", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "lease": { + "name": "lease", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "lease_expires_at": { + "name": "lease_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "metrics": { + "name": "metrics", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "mode": { + "name": "mode", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "output_manifest": { + "name": "output_manifest", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "parameters": { + "name": "parameters", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "progress": { + "name": "progress", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "recipe_id": { + "name": "recipe_id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "recipe_version": { + "name": "recipe_version", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "request_fingerprint": { + "name": "request_fingerprint", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "request_order": { + "name": "request_order", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "requested_by": { + "name": "requested_by", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "reused_run_id": { + "name": "reused_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "writer_fence": { + "name": "writer_fence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "analysis_run_one_active_request": { + "name": "analysis_run_one_active_request", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "request_fingerprint", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((status)::text = ANY (ARRAY[('queued'::character varying)::text, ('waiting_for_inputs'::character varying)::text, ('running'::character varying)::text]))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_project_idempotency": { + "name": "analysis_run_project_idempotency", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "idempotency_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_running_expiry": { + "name": "analysis_run_running_expiry", + "columns": [ + { + "expression": "lease_expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'running'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_running_lease": { + "name": "analysis_run_running_lease", + "columns": [ + { + "expression": "recipe_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lease_expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'running'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_scope_request_order": { + "name": "analysis_run_scope_request_order", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "request_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_scope_status_created": { + "name": "analysis_run_scope_status_created", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": false, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_free_charged": { + "name": "analysis_run_free_charged", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "(free_period_start IS NOT NULL)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_run_waiting_by_project": { + "name": "analysis_run_waiting_by_project", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "((status)::text = 'waiting_for_inputs'::text)", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_run_project_id_foreign": { + "name": "analysis_run_project_id_foreign", + "tableFrom": "analysis_run", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_run_reused_run_id_foreign": { + "name": "analysis_run_reused_run_id_foreign", + "tableFrom": "analysis_run", + "tableTo": "analysis_run", + "columnsFrom": [ + "reused_run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_run_scope_id_foreign": { + "name": "analysis_run_scope_id_foreign", + "tableFrom": "analysis_run", + "tableTo": "analysis_scope", + "columnsFrom": [ + "scope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_run_counters_valid": { + "name": "analysis_run_counters_valid", + "value": "(request_order >= 1) AND (epoch >= 0) AND (attempt >= 0)" + }, + "analysis_run_hash_version_valid": { + "name": "analysis_run_hash_version_valid", + "value": "(hash_version)::text = 'c14n-v1'::text" + }, + "analysis_run_mode_valid": { + "name": "analysis_run_mode_valid", + "value": "(mode)::text = ANY (ARRAY[('refresh'::character varying)::text, ('regenerate'::character varying)::text, ('retry'::character varying)::text])" + }, + "analysis_run_ready_has_manifest": { + "name": "analysis_run_ready_has_manifest", + "value": "((status)::text <> 'ready'::text) OR (output_manifest IS NOT NULL)" + }, + "analysis_run_running_has_lease": { + "name": "analysis_run_running_has_lease", + "value": "((status)::text <> 'running'::text) OR ((lease IS NOT NULL) AND (lease_expires_at IS NOT NULL))" + }, + "analysis_run_status_valid": { + "name": "analysis_run_status_valid", + "value": "(status)::text = ANY (ARRAY[('queued'::character varying)::text, ('waiting_for_inputs'::character varying)::text, ('running'::character varying)::text, ('needs_review'::character varying)::text, ('ready'::character varying)::text, ('failed'::character varying)::text, ('cancelled'::character varying)::text, ('superseded'::character varying)::text])" + }, + "analysis_run_writer_fence_valid": { + "name": "analysis_run_writer_fence_valid", + "value": "writer_fence >= 0" + } + }, + "isRLSEnabled": false + }, + "public.analysis_scope": { + "name": "analysis_scope", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "current_request_order": { + "name": "current_request_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "current_run_id": { + "name": "current_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "current_snapshot_id": { + "name": "current_snapshot_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "generation_epoch": { + "name": "generation_epoch", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "next_request_order": { + "name": "next_request_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "publication_sequence": { + "name": "publication_sequence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "recipe_id": { + "name": "recipe_id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "scope_key": { + "name": "scope_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "view_id": { + "name": "view_id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "writer": { + "name": "writer", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'analysis'" + }, + "writer_fence": { + "name": "writer_fence", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "analysis_scope_producer_identity": { + "name": "analysis_scope_producer_identity", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "recipe_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((kind)::text = 'producer'::text)", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_scope_view_identity": { + "name": "analysis_scope_view_identity", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "view_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((kind)::text = 'view'::text)", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_scope_current_run_id_foreign": { + "name": "analysis_scope_current_run_id_foreign", + "tableFrom": "analysis_scope", + "tableTo": "analysis_run", + "columnsFrom": [ + "current_run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_scope_current_snapshot_id_foreign": { + "name": "analysis_scope_current_snapshot_id_foreign", + "tableFrom": "analysis_scope", + "tableTo": "analysis_snapshot", + "columnsFrom": [ + "current_snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_scope_project_id_foreign": { + "name": "analysis_scope_project_id_foreign", + "tableFrom": "analysis_scope", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_scope_counters_valid": { + "name": "analysis_scope_counters_valid", + "value": "(next_request_order >= 1) AND (generation_epoch >= 0) AND (publication_sequence >= 0) AND (writer_fence >= 0) AND ((current_request_order IS NULL) OR (current_request_order >= 1))" + }, + "analysis_scope_kind_valid": { + "name": "analysis_scope_kind_valid", + "value": "(((kind)::text = 'producer'::text) AND (recipe_id IS NOT NULL) AND (view_id IS NULL) AND (current_snapshot_id IS NULL)) OR (((kind)::text = 'view'::text) AND (view_id IS NOT NULL) AND (recipe_id IS NULL) AND (current_run_id IS NULL))" + }, + "analysis_scope_writer_valid": { + "name": "analysis_scope_writer_valid", + "value": "(writer)::text = ANY (ARRAY[('legacy'::character varying)::text, ('analysis'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.analysis_snapshot": { + "name": "analysis_snapshot", + "schema": "", + "columns": { + "content_hash": { + "name": "content_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "embedding_config": { + "name": "embedding_config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "hash_version": { + "name": "hash_version", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'c14n-v1'" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "manifest": { + "name": "manifest", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "manifest_version": { + "name": "manifest_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "parent_snapshot_id": { + "name": "parent_snapshot_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "scope_id": { + "name": "scope_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "source_event_id": { + "name": "source_event_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "versions": { + "name": "versions", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "view_id": { + "name": "view_id", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": { + "analysis_snapshot_scope_created": { + "name": "analysis_snapshot_scope_created", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": false, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_snapshot_scope_source_event": { + "name": "analysis_snapshot_scope_source_event", + "columns": [ + { + "expression": "scope_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "source_event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "(source_event_id IS NOT NULL)", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_snapshot_parent_snapshot_id_foreign": { + "name": "analysis_snapshot_parent_snapshot_id_foreign", + "tableFrom": "analysis_snapshot", + "tableTo": "analysis_snapshot", + "columnsFrom": [ + "parent_snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_snapshot_project_id_foreign": { + "name": "analysis_snapshot_project_id_foreign", + "tableFrom": "analysis_snapshot", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_snapshot_scope_id_foreign": { + "name": "analysis_snapshot_scope_id_foreign", + "tableFrom": "analysis_snapshot", + "tableTo": "analysis_scope", + "columnsFrom": [ + "scope_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_snapshot_hash_version_valid": { + "name": "analysis_snapshot_hash_version_valid", + "value": "(hash_version)::text = 'c14n-v1'::text" + }, + "analysis_snapshot_manifest_version_valid": { + "name": "analysis_snapshot_manifest_version_valid", + "value": "manifest_version >= 1" + } + }, + "isRLSEnabled": false + }, + "public.analysis_step": { + "name": "analysis_step", + "schema": "", + "columns": { + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "cache_key": { + "name": "cache_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "checkpoint": { + "name": "checkpoint", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hash_version": { + "name": "hash_version", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'c14n-v1'" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "lease": { + "name": "lease", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "output": { + "name": "output", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "reused_step_id": { + "name": "reused_step_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "run_id": { + "name": "run_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "step_key": { + "name": "step_key", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "step_version": { + "name": "step_version", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "validation": { + "name": "validation", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "analysis_step_project_cache": { + "name": "analysis_step_project_cache", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "cache_key", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "completed_at", + "isExpression": false, + "asc": false, + "nulls": "first" + } + ], + "isUnique": false, + "where": "(((status)::text = 'completed'::text) AND (reused_step_id IS NULL))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "analysis_step_run_step": { + "name": "analysis_step_run_step", + "columns": [ + { + "expression": "run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "step_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "analysis_step_project_id_foreign": { + "name": "analysis_step_project_id_foreign", + "tableFrom": "analysis_step", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "analysis_step_reused_step_id_foreign": { + "name": "analysis_step_reused_step_id_foreign", + "tableFrom": "analysis_step", + "tableTo": "analysis_step", + "columnsFrom": [ + "reused_step_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "analysis_step_run_id_foreign": { + "name": "analysis_step_run_id_foreign", + "tableFrom": "analysis_step", + "tableTo": "analysis_run", + "columnsFrom": [ + "run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "analysis_step_attempt_valid": { + "name": "analysis_step_attempt_valid", + "value": "attempt >= 1" + }, + "analysis_step_hash_version_valid": { + "name": "analysis_step_hash_version_valid", + "value": "(hash_version)::text = 'c14n-v1'::text" + }, + "analysis_step_kind_valid": { + "name": "analysis_step_kind_valid", + "value": "(kind)::text = ANY (ARRAY[('model'::character varying)::text, ('deterministic'::character varying)::text, ('check'::character varying)::text])" + }, + "analysis_step_status_valid": { + "name": "analysis_step_status_valid", + "value": "(status)::text = ANY (ARRAY[('running'::character varying)::text, ('completed'::character varying)::text, ('failed'::character varying)::text])" + } + }, + "isRLSEnabled": false + }, + "public.announcement": { + "name": "announcement", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "level": { + "name": "level", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "announcement_user_created_foreign": { + "name": "announcement_user_created_foreign", + "tableFrom": "announcement", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "announcement_user_updated_foreign": { + "name": "announcement_user_updated_foreign", + "tableFrom": "announcement", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.announcement_activity": { + "name": "announcement_activity", + "schema": "", + "columns": { + "announcement_activity": { + "name": "announcement_activity", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "read": { + "name": "read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "announcement_activity_announcement_activity_foreign": { + "name": "announcement_activity_announcement_activity_foreign", + "tableFrom": "announcement_activity", + "tableTo": "announcement", + "columnsFrom": [ + "announcement_activity" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "announcement_activity_user_created_foreign": { + "name": "announcement_activity_user_created_foreign", + "tableFrom": "announcement_activity", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "announcement_activity_user_updated_foreign": { + "name": "announcement_activity_user_updated_foreign", + "tableFrom": "announcement_activity", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.announcement_translations": { + "name": "announcement_translations", + "schema": "", + "columns": { + "announcement_id": { + "name": "announcement_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "languages_code": { + "name": "languages_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "announcement_translations_announcement_id_foreign": { + "name": "announcement_translations_announcement_id_foreign", + "tableFrom": "announcement_translations", + "tableTo": "announcement", + "columnsFrom": [ + "announcement_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "announcement_translations_languages_code_foreign": { + "name": "announcement_translations_languages_code_foreign", + "tableFrom": "announcement_translations", + "tableTo": "languages", + "columnsFrom": [ + "languages_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.app_user": { + "name": "app_user", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "display_name": { + "name": "display_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "onboarding_answer_json": { + "name": "onboarding_answer_json", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "terms_accepted_at": { + "name": "terms_accepted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "app_user_directus_user_id_unique": { + "name": "app_user_directus_user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "directus_user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.billing_account": { + "name": "billing_account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "billing_period": { + "name": "billing_period", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "downgraded_at": { + "name": "downgraded_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "downgraded_from_tier": { + "name": "downgraded_from_tier", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "label": { + "name": "label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "mollie_customer_id": { + "name": "mollie_customer_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "mollie_subscription_id": { + "name": "mollie_subscription_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payment_mode": { + "name": "payment_mode", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "percent_discount": { + "name": "percent_discount", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "pre_warning_sent": { + "name": "pre_warning_sent", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "provisioned_seats": { + "name": "provisioned_seats", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'none'" + }, + "tier": { + "name": "tier", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'free'" + }, + "tier_expires_at": { + "name": "tier_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "type_discount": { + "name": "type_discount", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "account_manager_id": { + "name": "account_manager_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "recording_project_id": { + "name": "recording_project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "billing_address_line1": { + "name": "billing_address_line1", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_address_line2": { + "name": "billing_address_line2", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_city": { + "name": "billing_city", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_country": { + "name": "billing_country", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_legal_name": { + "name": "billing_legal_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_postal_code": { + "name": "billing_postal_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_vat_id": { + "name": "billing_vat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "billing_vat_region": { + "name": "billing_vat_region", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "payment_failed_notified": { + "name": "payment_failed_notified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "reconcile_failed_at": { + "name": "reconcile_failed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "kvk_number": { + "name": "kvk_number", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "kbo_number": { + "name": "kbo_number", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "billing_email": { + "name": "billing_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "po_number": { + "name": "po_number", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "peppol_id": { + "name": "peppol_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "peppol_name": { + "name": "peppol_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "invoice_delivery": { + "name": "invoice_delivery", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false + }, + "billing_country_code": { + "name": "billing_country_code", + "type": "varchar(2)", + "primaryKey": false, + "notNull": false + }, + "no_vat_number": { + "name": "no_vat_number", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "invoice_portal": { + "name": "invoice_portal", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ai_budget_micro_eur": { + "name": "ai_budget_micro_eur", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "ai_budget_unlimited": { + "name": "ai_budget_unlimited", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "ai_budget_until": { + "name": "ai_budget_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "billing_account_account_manager_id_foreign": { + "name": "billing_account_account_manager_id_foreign", + "tableFrom": "billing_account", + "tableTo": "app_user", + "columnsFrom": [ + "account_manager_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "billing_account_created_by_foreign": { + "name": "billing_account_created_by_foreign", + "tableFrom": "billing_account", + "tableTo": "app_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "billing_account_org_id_foreign": { + "name": "billing_account_org_id_foreign", + "tableFrom": "billing_account", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "billing_account_workspace_id_foreign": { + "name": "billing_account_workspace_id_foreign", + "tableFrom": "billing_account", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.canvas_config_revision": { + "name": "canvas_config_revision", + "schema": "", + "columns": { + "brief": { + "name": "brief", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cadence_minutes": { + "name": "cadence_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 5 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "gather_spec": { + "name": "gather_spec", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "note": { + "name": "note", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "report_id": { + "name": "report_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "popcorn_settings": { + "name": "popcorn_settings", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "canvas_config_revision_report_id_foreign": { + "name": "canvas_config_revision_report_id_foreign", + "tableFrom": "canvas_config_revision", + "tableTo": "project_report", + "columnsFrom": [ + "report_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.canvas_generation": { + "name": "canvas_generation", + "schema": "", + "columns": { + "config_revision_id": { + "name": "config_revision_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content_html": { + "name": "content_html", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "report_id": { + "name": "report_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'ok'" + }, + "tick_kind": { + "name": "tick_kind", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "canvas_generation_config_revision_id_foreign": { + "name": "canvas_generation_config_revision_id_foreign", + "tableFrom": "canvas_generation", + "tableTo": "canvas_config_revision", + "columnsFrom": [ + "config_revision_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "canvas_generation_report_id_foreign": { + "name": "canvas_generation_report_id_foreign", + "tableFrom": "canvas_generation", + "tableTo": "project_report", + "columnsFrom": [ + "report_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation": { + "name": "conversation", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "is_all_chunks_transcribed": { + "name": "is_all_chunks_transcribed", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_anonymized": { + "name": "is_anonymized", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_audio_processing_finished": { + "name": "is_audio_processing_finished", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_finished": { + "name": "is_finished", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_over_cap": { + "name": "is_over_cap", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "merged_audio_path": { + "name": "merged_audio_path", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "merged_transcript": { + "name": "merged_transcript", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "participant_email": { + "name": "participant_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "participant_name": { + "name": "participant_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "participant_user_agent": { + "name": "participant_user_agent", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "move_history": { + "name": "move_history", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "token_count": { + "name": "token_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "recording_started_at": { + "name": "recording_started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "ai_stopped_at": { + "name": "ai_stopped_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "landscape_status": { + "name": "landscape_status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false + }, + "landscape_review": { + "name": "landscape_review", + "type": "varchar(16)", + "primaryKey": false, + "notNull": false + }, + "landscape_text": { + "name": "landscape_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "landscape_text_hash": { + "name": "landscape_text_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "landscape_consent_version": { + "name": "landscape_consent_version", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "landscape_decided_at": { + "name": "landscape_decided_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "landscape_moderation": { + "name": "landscape_moderation", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "landscape_entered_at": { + "name": "landscape_entered_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_project_id_foreign": { + "name": "conversation_project_id_foreign", + "tableFrom": "conversation", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "conversation_landscape_status": { + "name": "conversation_landscape_status", + "value": "\"conversation\".\"landscape_status\" in ('pending', 'accepted', 'rejected')" + }, + "conversation_landscape_review": { + "name": "conversation_landscape_review", + "value": "\"conversation\".\"landscape_review\" in ('auto_approved', 'held', 'host_approved', 'host_rejected')" + }, + "conversation_landscape_entry": { + "name": "conversation_landscape_entry", + "value": "\"conversation\".\"landscape_entered_at\" is null or (coalesce(\"conversation\".\"landscape_status\", '') = 'accepted' and coalesce(\"conversation\".\"landscape_review\", '') in ('auto_approved', 'host_approved') and \"conversation\".\"landscape_text\" is not null)" + } + }, + "isRLSEnabled": false + }, + "public.conversation_artifact": { + "name": "conversation_artifact", + "schema": "", + "columns": { + "approved_at": { + "name": "approved_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "last_updated_at": { + "name": "last_updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "read_aloud_stream_url": { + "name": "read_aloud_stream_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "topic_label": { + "name": "topic_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_artifact_conversation_id_foreign": { + "name": "conversation_artifact_conversation_id_foreign", + "tableFrom": "conversation_artifact", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "conversation_artifact_user_created_foreign": { + "name": "conversation_artifact_user_created_foreign", + "tableFrom": "conversation_artifact", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "conversation_artifact_user_updated_foreign": { + "name": "conversation_artifact_user_updated_foreign", + "tableFrom": "conversation_artifact", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_chunk": { + "name": "conversation_chunk", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "cross_talk_instances": { + "name": "cross_talk_instances", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "desired_language": { + "name": "desired_language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "detected_language": { + "name": "detected_language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "detected_language_confidence": { + "name": "detected_language_confidence", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "diarization": { + "name": "diarization", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hallucination_reason": { + "name": "hallucination_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "hallucination_score": { + "name": "hallucination_score", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "noise_ratio": { + "name": "noise_ratio", + "type": "real", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "pending_text": { + "name": "pending_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "raw_transcript": { + "name": "raw_transcript", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "runpod_job_status_link": { + "name": "runpod_job_status_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "runpod_request_count": { + "name": "runpod_request_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "audio_seconds": { + "name": "audio_seconds", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "segments": { + "name": "segments", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "silence_ratio": { + "name": "silence_ratio", + "type": "real", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "transcript": { + "name": "transcript", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "translation_error": { + "name": "translation_error", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "conversation_chunk_timestamp_index": { + "name": "conversation_chunk_timestamp_index", + "columns": [ + { + "expression": "timestamp", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_chunk_conv_timestamp": { + "name": "idx_chunk_conv_timestamp", + "columns": [ + { + "expression": "conversation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "timestamp", + "isExpression": false, + "asc": false, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "conversation_chunk_conversation_id_foreign": { + "name": "conversation_chunk_conversation_id_foreign", + "tableFrom": "conversation_chunk", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_final_transcript": { + "name": "conversation_final_transcript", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "chunk_hash": { + "name": "chunk_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_record": { + "name": "is_record", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sentences": { + "name": "sentences", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "raw_sentences": { + "name": "raw_sentences", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "audio_seconds": { + "name": "audio_seconds", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "usage": { + "name": "usage", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_final_transcript_conversation_id_foreign": { + "name": "conversation_final_transcript_conversation_id_foreign", + "tableFrom": "conversation_final_transcript", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "conversation_final_transcript_conversation_id_provider_pk": { + "name": "conversation_final_transcript_conversation_id_provider_pk", + "columns": [ + "conversation_id", + "provider" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_link": { + "name": "conversation_link", + "schema": "", + "columns": { + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "link_type": { + "name": "link_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "source_conversation_id": { + "name": "source_conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "target_conversation_id": { + "name": "target_conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "conversation_link_source_conversation_id_index": { + "name": "conversation_link_source_conversation_id_index", + "columns": [ + { + "expression": "source_conversation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "conversation_link_target_conversation_id_index": { + "name": "conversation_link_target_conversation_id_index", + "columns": [ + { + "expression": "target_conversation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "conversation_link_source_conversation_id_foreign": { + "name": "conversation_link_source_conversation_id_foreign", + "tableFrom": "conversation_link", + "tableTo": "conversation", + "columnsFrom": [ + "source_conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "conversation_link_target_conversation_id_foreign": { + "name": "conversation_link_target_conversation_id_foreign", + "tableFrom": "conversation_link", + "tableTo": "conversation", + "columnsFrom": [ + "target_conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_project_tag": { + "name": "conversation_project_tag", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_tag_id": { + "name": "project_tag_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_project_tag_conversation_id_foreign": { + "name": "conversation_project_tag_conversation_id_foreign", + "tableFrom": "conversation_project_tag", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "conversation_project_tag_project_tag_id_foreign": { + "name": "conversation_project_tag_project_tag_id_foreign", + "tableFrom": "conversation_project_tag", + "tableTo": "project_tag", + "columnsFrom": [ + "project_tag_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_reply": { + "name": "conversation_reply", + "schema": "", + "columns": { + "content_text": { + "name": "content_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "conversation_id": { + "name": "conversation_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "reply": { + "name": "reply", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_reply_reply_foreign": { + "name": "conversation_reply_reply_foreign", + "tableFrom": "conversation_reply", + "tableTo": "conversation", + "columnsFrom": [ + "reply" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.conversation_transcribe_retry": { + "name": "conversation_transcribe_retry", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "stage": { + "name": "stage", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "spans": { + "name": "spans", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "improved": { + "name": "improved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kept": { + "name": "kept", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "failed": { + "name": "failed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "conversation_transcribe_retry_conversation_id_foreign": { + "name": "conversation_transcribe_retry_conversation_id_foreign", + "tableFrom": "conversation_transcribe_retry", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "conversation_transcribe_retry_conversation_id_stage_pk": { + "name": "conversation_transcribe_retry_conversation_id_stage_pk", + "columns": [ + "conversation_id", + "stage" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_access": { + "name": "directus_access", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "role": { + "name": "role", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user": { + "name": "user", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "policy": { + "name": "policy", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_access_policy_foreign": { + "name": "directus_access_policy_foreign", + "tableFrom": "directus_access", + "tableTo": "directus_policies", + "columnsFrom": [ + "policy" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_access_role_foreign": { + "name": "directus_access_role_foreign", + "tableFrom": "directus_access", + "tableTo": "directus_roles", + "columnsFrom": [ + "role" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_access_user_foreign": { + "name": "directus_access_user_foreign", + "tableFrom": "directus_access", + "tableTo": "directus_users", + "columnsFrom": [ + "user" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_activity": { + "name": "directus_activity", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(45)", + "primaryKey": false, + "notNull": true + }, + "user": { + "name": "user", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "ip": { + "name": "ip", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "origin": { + "name": "origin", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_collections": { + "name": "directus_collections", + "schema": "", + "columns": { + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": true, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_template": { + "name": "display_template", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "hidden": { + "name": "hidden", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "singleton": { + "name": "singleton", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "translations": { + "name": "translations", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "archive_field": { + "name": "archive_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "archive_app_filter": { + "name": "archive_app_filter", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "archive_value": { + "name": "archive_value", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "unarchive_value": { + "name": "unarchive_value", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "sort_field": { + "name": "sort_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "accountability": { + "name": "accountability", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'all'" + }, + "color": { + "name": "color", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "item_duplication_fields": { + "name": "item_duplication_fields", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "group": { + "name": "group", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "collapse": { + "name": "collapse", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "preview_url": { + "name": "preview_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "versioning": { + "name": "versioning", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_collections_group_foreign": { + "name": "directus_collections_group_foreign", + "tableFrom": "directus_collections", + "tableTo": "directus_collections", + "columnsFrom": [ + "group" + ], + "columnsTo": [ + "collection" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_comments": { + "name": "directus_comments", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_comments_user_created_foreign": { + "name": "directus_comments_user_created_foreign", + "tableFrom": "directus_comments", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "directus_comments_user_updated_foreign": { + "name": "directus_comments_user_updated_foreign", + "tableFrom": "directus_comments", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_dashboards": { + "name": "directus_dashboards", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "'dashboard'" + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_dashboards_user_created_foreign": { + "name": "directus_dashboards_user_created_foreign", + "tableFrom": "directus_dashboards", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_extensions": { + "name": "directus_extensions", + "schema": "", + "columns": { + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "folder": { + "name": "folder", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "bundle": { + "name": "bundle", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_fields": { + "name": "directus_fields", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "field": { + "name": "field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "special": { + "name": "special", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "interface": { + "name": "interface", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "options": { + "name": "options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "display": { + "name": "display", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "display_options": { + "name": "display_options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "readonly": { + "name": "readonly", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "hidden": { + "name": "hidden", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "varchar(30)", + "primaryKey": false, + "notNull": false, + "default": "'full'" + }, + "translations": { + "name": "translations", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "conditions": { + "name": "conditions", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "group": { + "name": "group", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "validation": { + "name": "validation", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "validation_message": { + "name": "validation_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "searchable": { + "name": "searchable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_files": { + "name": "directus_files", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "storage": { + "name": "storage", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "filename_disk": { + "name": "filename_disk", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "filename_download": { + "name": "filename_download", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "folder": { + "name": "folder", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "uploaded_by": { + "name": "uploaded_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "modified_by": { + "name": "modified_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modified_on": { + "name": "modified_on", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "charset": { + "name": "charset", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "filesize": { + "name": "filesize", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "embed": { + "name": "embed", + "type": "varchar(200)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "focal_point_x": { + "name": "focal_point_x", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "focal_point_y": { + "name": "focal_point_y", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tus_id": { + "name": "tus_id", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "tus_data": { + "name": "tus_data", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "uploaded_on": { + "name": "uploaded_on", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_files_folder_foreign": { + "name": "directus_files_folder_foreign", + "tableFrom": "directus_files", + "tableTo": "directus_folders", + "columnsFrom": [ + "folder" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "directus_files_modified_by_foreign": { + "name": "directus_files_modified_by_foreign", + "tableFrom": "directus_files", + "tableTo": "directus_users", + "columnsFrom": [ + "modified_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_files_uploaded_by_foreign": { + "name": "directus_files_uploaded_by_foreign", + "tableFrom": "directus_files", + "tableTo": "directus_users", + "columnsFrom": [ + "uploaded_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_flows": { + "name": "directus_flows", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "trigger": { + "name": "trigger", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "accountability": { + "name": "accountability", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'all'" + }, + "options": { + "name": "options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "operation": { + "name": "operation", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_flows_user_created_foreign": { + "name": "directus_flows_user_created_foreign", + "tableFrom": "directus_flows", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "directus_flows_operation_unique": { + "name": "directus_flows_operation_unique", + "nullsNotDistinct": false, + "columns": [ + "operation" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_folders": { + "name": "directus_folders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "parent": { + "name": "parent", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_folders_parent_foreign": { + "name": "directus_folders_parent_foreign", + "tableFrom": "directus_folders", + "tableTo": "directus_folders", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_migrations": { + "name": "directus_migrations", + "schema": "", + "columns": { + "version": { + "name": "version", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_notifications": { + "name": "directus_notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'inbox'" + }, + "recipient": { + "name": "recipient", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "sender": { + "name": "sender", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_notifications_recipient_foreign": { + "name": "directus_notifications_recipient_foreign", + "tableFrom": "directus_notifications", + "tableTo": "directus_users", + "columnsFrom": [ + "recipient" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_notifications_sender_foreign": { + "name": "directus_notifications_sender_foreign", + "tableFrom": "directus_notifications", + "tableTo": "directus_users", + "columnsFrom": [ + "sender" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_operations": { + "name": "directus_operations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "position_x": { + "name": "position_x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "position_y": { + "name": "position_y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "options": { + "name": "options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "resolve": { + "name": "resolve", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "reject": { + "name": "reject", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flow": { + "name": "flow", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_operations_flow_foreign": { + "name": "directus_operations_flow_foreign", + "tableFrom": "directus_operations", + "tableTo": "directus_flows", + "columnsFrom": [ + "flow" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_operations_reject_foreign": { + "name": "directus_operations_reject_foreign", + "tableFrom": "directus_operations", + "tableTo": "directus_operations", + "columnsFrom": [ + "reject" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_operations_resolve_foreign": { + "name": "directus_operations_resolve_foreign", + "tableFrom": "directus_operations", + "tableTo": "directus_operations", + "columnsFrom": [ + "resolve" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_operations_user_created_foreign": { + "name": "directus_operations_user_created_foreign", + "tableFrom": "directus_operations", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "directus_operations_resolve_unique": { + "name": "directus_operations_resolve_unique", + "nullsNotDistinct": false, + "columns": [ + "resolve" + ] + }, + "directus_operations_reject_unique": { + "name": "directus_operations_reject_unique", + "nullsNotDistinct": false, + "columns": [ + "reject" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_panels": { + "name": "directus_panels", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "dashboard": { + "name": "dashboard", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "color": { + "name": "color", + "type": "varchar(10)", + "primaryKey": false, + "notNull": false + }, + "show_header": { + "name": "show_header", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "position_x": { + "name": "position_x", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "position_y": { + "name": "position_y", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "options": { + "name": "options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_panels_dashboard_foreign": { + "name": "directus_panels_dashboard_foreign", + "tableFrom": "directus_panels", + "tableTo": "directus_dashboards", + "columnsFrom": [ + "dashboard" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_panels_user_created_foreign": { + "name": "directus_panels_user_created_foreign", + "tableFrom": "directus_panels", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_permissions": { + "name": "directus_permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true + }, + "permissions": { + "name": "permissions", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "validation": { + "name": "validation", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "presets": { + "name": "presets", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "fields": { + "name": "fields", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "policy": { + "name": "policy", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "directus_permissions_policy_foreign": { + "name": "directus_permissions_policy_foreign", + "tableFrom": "directus_permissions", + "tableTo": "directus_policies", + "columnsFrom": [ + "policy" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_policies": { + "name": "directus_policies", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "'badge'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ip_access": { + "name": "ip_access", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enforce_tfa": { + "name": "enforce_tfa", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "admin_access": { + "name": "admin_access", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "app_access": { + "name": "app_access", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_presets": { + "name": "directus_presets", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "bookmark": { + "name": "bookmark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "user": { + "name": "user", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "search": { + "name": "search", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "layout": { + "name": "layout", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false, + "default": "'tabular'" + }, + "layout_query": { + "name": "layout_query", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "layout_options": { + "name": "layout_options", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "refresh_interval": { + "name": "refresh_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "filter": { + "name": "filter", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "'bookmark'" + }, + "color": { + "name": "color", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_presets_role_foreign": { + "name": "directus_presets_role_foreign", + "tableFrom": "directus_presets", + "tableTo": "directus_roles", + "columnsFrom": [ + "role" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_presets_user_foreign": { + "name": "directus_presets_user_foreign", + "tableFrom": "directus_presets", + "tableTo": "directus_users", + "columnsFrom": [ + "user" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_relations": { + "name": "directus_relations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "many_collection": { + "name": "many_collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "many_field": { + "name": "many_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "one_collection": { + "name": "one_collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "one_field": { + "name": "one_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "one_collection_field": { + "name": "one_collection_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "one_allowed_collections": { + "name": "one_allowed_collections", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "junction_field": { + "name": "junction_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "sort_field": { + "name": "sort_field", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "one_deselect_action": { + "name": "one_deselect_action", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'nullify'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_revisions": { + "name": "directus_revisions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "activity": { + "name": "activity", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "data": { + "name": "data", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "delta": { + "name": "delta", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "parent": { + "name": "parent", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_revisions_activity_foreign": { + "name": "directus_revisions_activity_foreign", + "tableFrom": "directus_revisions", + "tableTo": "directus_activity", + "columnsFrom": [ + "activity" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_revisions_parent_foreign": { + "name": "directus_revisions_parent_foreign", + "tableFrom": "directus_revisions", + "tableTo": "directus_revisions", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_revisions_version_foreign": { + "name": "directus_revisions_version_foreign", + "tableFrom": "directus_revisions", + "tableTo": "directus_versions", + "columnsFrom": [ + "version" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_roles": { + "name": "directus_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "'supervised_user_circle'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent": { + "name": "parent", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_roles_parent_foreign": { + "name": "directus_roles_parent_foreign", + "tableFrom": "directus_roles", + "tableTo": "directus_roles", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_sessions": { + "name": "directus_sessions", + "schema": "", + "columns": { + "token": { + "name": "token", + "type": "varchar(64)", + "primaryKey": true, + "notNull": true + }, + "user": { + "name": "user", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "expires": { + "name": "expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ip": { + "name": "ip", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "share": { + "name": "share", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "origin": { + "name": "origin", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "next_token": { + "name": "next_token", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_sessions_share_foreign": { + "name": "directus_sessions_share_foreign", + "tableFrom": "directus_sessions", + "tableTo": "directus_shares", + "columnsFrom": [ + "share" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_sessions_user_foreign": { + "name": "directus_sessions_user_foreign", + "tableFrom": "directus_sessions", + "tableTo": "directus_users", + "columnsFrom": [ + "user" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_settings": { + "name": "directus_settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_name": { + "name": "project_name", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true, + "default": "'Directus'" + }, + "project_url": { + "name": "project_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_color": { + "name": "project_color", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'#6644FF'" + }, + "project_logo": { + "name": "project_logo", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "public_foreground": { + "name": "public_foreground", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "public_background": { + "name": "public_background", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "public_note": { + "name": "public_note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auth_login_attempts": { + "name": "auth_login_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 25 + }, + "auth_password_policy": { + "name": "auth_password_policy", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "storage_asset_transform": { + "name": "storage_asset_transform", + "type": "varchar(7)", + "primaryKey": false, + "notNull": false, + "default": "'all'" + }, + "storage_asset_presets": { + "name": "storage_asset_presets", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "custom_css": { + "name": "custom_css", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "storage_default_folder": { + "name": "storage_default_folder", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "basemaps": { + "name": "basemaps", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "mapbox_key": { + "name": "mapbox_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "module_bar": { + "name": "module_bar", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_descriptor": { + "name": "project_descriptor", + "type": "varchar(100)", + "primaryKey": false, + "notNull": false + }, + "default_language": { + "name": "default_language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'en-US'" + }, + "custom_aspect_ratios": { + "name": "custom_aspect_ratios", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "public_favicon": { + "name": "public_favicon", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "default_appearance": { + "name": "default_appearance", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'auto'" + }, + "default_theme_light": { + "name": "default_theme_light", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "theme_light_overrides": { + "name": "theme_light_overrides", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "default_theme_dark": { + "name": "default_theme_dark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "theme_dark_overrides": { + "name": "theme_dark_overrides", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "report_error_url": { + "name": "report_error_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "report_bug_url": { + "name": "report_bug_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "report_feature_url": { + "name": "report_feature_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "public_registration": { + "name": "public_registration", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "public_registration_verify_email": { + "name": "public_registration_verify_email", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "public_registration_role": { + "name": "public_registration_role", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "public_registration_email_filter": { + "name": "public_registration_email_filter", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "visual_editor_urls": { + "name": "visual_editor_urls", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "mcp_enabled": { + "name": "mcp_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "mcp_allow_deletes": { + "name": "mcp_allow_deletes", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "mcp_prompts_collection": { + "name": "mcp_prompts_collection", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "mcp_system_prompt_enabled": { + "name": "mcp_system_prompt_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "mcp_system_prompt": { + "name": "mcp_system_prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_owner": { + "name": "project_owner", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "project_usage": { + "name": "project_usage", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "org_name": { + "name": "org_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "product_updates": { + "name": "product_updates", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "project_status": { + "name": "project_status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_settings_project_logo_foreign": { + "name": "directus_settings_project_logo_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_files", + "columnsFrom": [ + "project_logo" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_settings_public_background_foreign": { + "name": "directus_settings_public_background_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_files", + "columnsFrom": [ + "public_background" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_settings_public_favicon_foreign": { + "name": "directus_settings_public_favicon_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_files", + "columnsFrom": [ + "public_favicon" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_settings_public_foreground_foreign": { + "name": "directus_settings_public_foreground_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_files", + "columnsFrom": [ + "public_foreground" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "directus_settings_public_registration_role_foreign": { + "name": "directus_settings_public_registration_role_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_roles", + "columnsFrom": [ + "public_registration_role" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "directus_settings_storage_default_folder_foreign": { + "name": "directus_settings_storage_default_folder_foreign", + "tableFrom": "directus_settings", + "tableTo": "directus_folders", + "columnsFrom": [ + "storage_default_folder" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_shares": { + "name": "directus_shares", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "date_start": { + "name": "date_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_end": { + "name": "date_end", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "times_used": { + "name": "times_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "max_uses": { + "name": "max_uses", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_shares_collection_foreign": { + "name": "directus_shares_collection_foreign", + "tableFrom": "directus_shares", + "tableTo": "directus_collections", + "columnsFrom": [ + "collection" + ], + "columnsTo": [ + "collection" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_shares_role_foreign": { + "name": "directus_shares_role_foreign", + "tableFrom": "directus_shares", + "tableTo": "directus_roles", + "columnsFrom": [ + "role" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_shares_user_created_foreign": { + "name": "directus_shares_user_created_foreign", + "tableFrom": "directus_shares", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_sync_id_map": { + "name": "directus_sync_id_map", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "table": { + "name": "table", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "sync_id": { + "name": "sync_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "local_id": { + "name": "local_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "directus_sync_id_map_created_at_index": { + "name": "directus_sync_id_map_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "directus_sync_id_map_table_local_id_unique": { + "name": "directus_sync_id_map_table_local_id_unique", + "nullsNotDistinct": false, + "columns": [ + "table", + "local_id" + ] + }, + "directus_sync_id_map_table_sync_id_unique": { + "name": "directus_sync_id_map_table_sync_id_unique", + "nullsNotDistinct": false, + "columns": [ + "table", + "sync_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_translations": { + "name": "directus_translations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "language": { + "name": "language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_users": { + "name": "directus_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "first_name": { + "name": "first_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "avatar": { + "name": "avatar", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "language": { + "name": "language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "tfa_secret": { + "name": "tfa_secret", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(16)", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "role": { + "name": "role", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "last_access": { + "name": "last_access", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_page": { + "name": "last_page", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "varchar(128)", + "primaryKey": false, + "notNull": true, + "default": "'default'" + }, + "external_identifier": { + "name": "external_identifier", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "auth_data": { + "name": "auth_data", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "email_notifications": { + "name": "email_notifications", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "appearance": { + "name": "appearance", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "theme_dark": { + "name": "theme_dark", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "theme_light": { + "name": "theme_light", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "theme_light_overrides": { + "name": "theme_light_overrides", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "theme_dark_overrides": { + "name": "theme_dark_overrides", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "text_direction": { + "name": "text_direction", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'auto'" + }, + "disable_create_project": { + "name": "disable_create_project", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "hide_ai_suggestions": { + "name": "hide_ai_suggestions", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "legal_basis": { + "name": "legal_basis", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'client-managed'" + }, + "privacy_policy_url": { + "name": "privacy_policy_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "quick_access_preferences": { + "name": "quick_access_preferences", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "whitelabel_logo": { + "name": "whitelabel_logo", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_users_role_foreign": { + "name": "directus_users_role_foreign", + "tableFrom": "directus_users", + "tableTo": "directus_roles", + "columnsFrom": [ + "role" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "directus_users_whitelabel_logo_foreign": { + "name": "directus_users_whitelabel_logo_foreign", + "tableFrom": "directus_users", + "tableTo": "directus_files", + "columnsFrom": [ + "whitelabel_logo" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "directus_users_email_unique": { + "name": "directus_users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "directus_users_token_unique": { + "name": "directus_users_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + }, + "directus_users_external_identifier_unique": { + "name": "directus_users_external_identifier_unique", + "nullsNotDistinct": false, + "columns": [ + "external_identifier" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_versions": { + "name": "directus_versions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "key": { + "name": "key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "collection": { + "name": "collection", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "item": { + "name": "item", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "hash": { + "name": "hash", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "delta": { + "name": "delta", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_versions_collection_foreign": { + "name": "directus_versions_collection_foreign", + "tableFrom": "directus_versions", + "tableTo": "directus_collections", + "columnsFrom": [ + "collection" + ], + "columnsTo": [ + "collection" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "directus_versions_user_created_foreign": { + "name": "directus_versions_user_created_foreign", + "tableFrom": "directus_versions", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "directus_versions_user_updated_foreign": { + "name": "directus_versions_user_updated_foreign", + "tableFrom": "directus_versions", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.directus_webhooks": { + "name": "directus_webhooks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "default": "'POST'" + }, + "url": { + "name": "url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(10)", + "primaryKey": false, + "notNull": true, + "default": "'active'" + }, + "data": { + "name": "data", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "actions": { + "name": "actions", + "type": "varchar(100)", + "primaryKey": false, + "notNull": true + }, + "collections": { + "name": "collections", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true + }, + "headers": { + "name": "headers", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "was_active_before_deprecation": { + "name": "was_active_before_deprecation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "migrated_flow": { + "name": "migrated_flow", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "directus_webhooks_migrated_flow_foreign": { + "name": "directus_webhooks_migrated_flow_foreign", + "tableFrom": "directus_webhooks", + "tableTo": "directus_flows", + "columnsFrom": [ + "migrated_flow" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.languages": { + "name": "languages", + "schema": "", + "columns": { + "code": { + "name": "code", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true, + "default": "NULL" + }, + "direction": { + "name": "direction", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'ltr'" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.map_embedding": { + "name": "map_embedding", + "schema": "", + "columns": { + "config_key": { + "name": "config_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "dims": { + "name": "dims", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "input_hash": { + "name": "input_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "model": { + "name": "model", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "embedding": { + "name": "embedding", + "type": "vector", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "map_embedding_project_input_config": { + "name": "map_embedding_project_input_config", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "input_hash", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "config_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "map_embedding_project_id_foreign": { + "name": "map_embedding_project_id_foreign", + "tableFrom": "map_embedding", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "map_embedding_dims_match": { + "name": "map_embedding_dims_match", + "value": "(dims > 0) AND (vector_dims(embedding) = dims)" + }, + "map_embedding_nonzero": { + "name": "map_embedding_nonzero", + "value": "vector_norm(embedding) > (0)::double precision" + } + }, + "isRLSEnabled": false + }, + "public.map_fact_check": { + "name": "map_fact_check", + "schema": "", + "columns": { + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "claim_key": { + "name": "claim_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "justification": { + "name": "justification", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "prompt_version": { + "name": "prompt_version", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "requested_by": { + "name": "requested_by", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "sources": { + "name": "sources", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "statement": { + "name": "statement", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "verdict": { + "name": "verdict", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": { + "map_fact_check_project_claim": { + "name": "map_fact_check_project_claim", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "claim_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "map_fact_check_project_id_foreign": { + "name": "map_fact_check_project_id_foreign", + "tableFrom": "map_fact_check", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.map_group": { + "name": "map_group", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "selection_key": { + "name": "selection_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "members": { + "name": "members", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model": { + "name": "model", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false + }, + "prompt_version": { + "name": "prompt_version", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "map_group_project_selection": { + "name": "map_group_project_selection", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "selection_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "map_group_project_id_foreign": { + "name": "map_group_project_id_foreign", + "tableFrom": "map_group", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.map_result": { + "name": "map_result", + "schema": "", + "columns": { + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "embedding_config": { + "name": "embedding_config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "execution_ref": { + "name": "execution_ref", + "type": "varchar(128)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "manifest": { + "name": "manifest", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "manifest_version": { + "name": "manifest_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "progress": { + "name": "progress", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "recipe_version": { + "name": "recipe_version", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "requested_by": { + "name": "requested_by", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source_fingerprint": { + "name": "source_fingerprint", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "map_result_one_active_attempt": { + "name": "map_result_one_active_attempt", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "((status)::text = ANY (ARRAY[('queued'::character varying)::text, ('extracting'::character varying)::text, ('embedding'::character varying)::text]))", + "concurrently": false, + "method": "btree", + "with": {} + }, + "map_result_project_status_created": { + "name": "map_result_project_status_created", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": false, + "nulls": "first" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "map_result_project_id_foreign": { + "name": "map_result_project_id_foreign", + "tableFrom": "map_result", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "map_result_snapshot_id_foreign": { + "name": "map_result_snapshot_id_foreign", + "tableFrom": "map_result", + "tableTo": "analysis_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "map_result_manifest_version_valid": { + "name": "map_result_manifest_version_valid", + "value": "manifest_version = ANY (ARRAY[1, 2])" + } + }, + "isRLSEnabled": false + }, + "public.methodology": { + "name": "methodology", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "framing": { + "name": "framing", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "is_seeded": { + "name": "is_seeded", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "owner_directus_user_id": { + "name": "owner_directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "visibility": { + "name": "visibility", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'private'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "methodology_workspace_id_foreign": { + "name": "methodology_workspace_id_foreign", + "tableFrom": "methodology", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.methodology_version": { + "name": "methodology_version", + "schema": "", + "columns": { + "content": { + "name": "content", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "methodology_id": { + "name": "methodology_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "methodology_version_methodology_id_foreign": { + "name": "methodology_version_methodology_id_foreign", + "tableFrom": "methodology_version", + "tableTo": "methodology", + "columnsFrom": [ + "methodology_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.model_response_feedback": { + "name": "model_response_feedback", + "schema": "", + "columns": { + "chat_mode": { + "name": "chat_mode", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "context": { + "name": "context", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "rating": { + "name": "rating", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "reason": { + "name": "reason", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "reasons": { + "name": "reasons", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "response_snapshot": { + "name": "response_snapshot", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "target_type": { + "name": "target_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "model_response_feedback_project_id_foreign": { + "name": "model_response_feedback_project_id_foreign", + "tableFrom": "model_response_feedback", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "model_response_feedback_user_id_foreign": { + "name": "model_response_feedback_user_id_foreign", + "tableFrom": "model_response_feedback", + "tableTo": "directus_users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notification": { + "name": "notification", + "schema": "", + "columns": { + "action": { + "name": "action", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'NONE'" + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "audience_user_id": { + "name": "audience_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "event_code": { + "name": "event_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "params": { + "name": "params", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "read_at": { + "name": "read_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "ref_chat_id": { + "name": "ref_chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ref_conversation_id": { + "name": "ref_conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ref_invite_id": { + "name": "ref_invite_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ref_org_id": { + "name": "ref_org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ref_project_id": { + "name": "ref_project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "ref_report_id": { + "name": "ref_report_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "ref_workspace_id": { + "name": "ref_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "severity": { + "name": "severity", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'info'" + }, + "title": { + "name": "title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": { + "notification_actor_user_id_foreign": { + "name": "notification_actor_user_id_foreign", + "tableFrom": "notification", + "tableTo": "app_user", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_audience_user_id_foreign": { + "name": "notification_audience_user_id_foreign", + "tableFrom": "notification", + "tableTo": "app_user", + "columnsFrom": [ + "audience_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notification_ref_chat_id_foreign": { + "name": "notification_ref_chat_id_foreign", + "tableFrom": "notification", + "tableTo": "project_chat", + "columnsFrom": [ + "ref_chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_ref_conversation_id_foreign": { + "name": "notification_ref_conversation_id_foreign", + "tableFrom": "notification", + "tableTo": "conversation", + "columnsFrom": [ + "ref_conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_ref_invite_id_foreign": { + "name": "notification_ref_invite_id_foreign", + "tableFrom": "notification", + "tableTo": "workspace_invite", + "columnsFrom": [ + "ref_invite_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_ref_org_id_foreign": { + "name": "notification_ref_org_id_foreign", + "tableFrom": "notification", + "tableTo": "org", + "columnsFrom": [ + "ref_org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_ref_project_id_foreign": { + "name": "notification_ref_project_id_foreign", + "tableFrom": "notification", + "tableTo": "project", + "columnsFrom": [ + "ref_project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "notification_ref_workspace_id_foreign": { + "name": "notification_ref_workspace_id_foreign", + "tableFrom": "notification", + "tableTo": "workspace", + "columnsFrom": [ + "ref_workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org": { + "name": "org", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "logo_url": { + "name": "logo_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_partner": { + "name": "is_partner", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "agent_access_enabled": { + "name": "agent_access_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "agent_access_updated_at": { + "name": "agent_access_updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "agent_access_updated_by": { + "name": "agent_access_updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "account_stage": { + "name": "account_stage", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "origin_pricing_configuration_id": { + "name": "origin_pricing_configuration_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "org_created_by_foreign": { + "name": "org_created_by_foreign", + "tableFrom": "org", + "tableTo": "app_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "org_origin_pricing_configuration_id_foreign": { + "name": "org_origin_pricing_configuration_id_foreign", + "tableFrom": "org", + "tableTo": "pricing_configuration", + "columnsFrom": [ + "origin_pricing_configuration_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "org_account_stage_check": { + "name": "org_account_stage_check", + "value": "\"org\".\"account_stage\" is null or \"org\".\"account_stage\" in ('prospect', 'customer', 'churned')" + } + }, + "isRLSEnabled": false + }, + "public.org_invite": { + "name": "org_invite", + "schema": "", + "columns": { + "accepted_at": { + "name": "accepted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'member'" + } + }, + "indexes": { + "org_invite_accepted_at_index": { + "name": "org_invite_accepted_at_index", + "columns": [ + { + "expression": "accepted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_invite_deleted_at_index": { + "name": "org_invite_deleted_at_index", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_invite_email_index": { + "name": "org_invite_email_index", + "columns": [ + { + "expression": "email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "org_invite_invited_by_foreign": { + "name": "org_invite_invited_by_foreign", + "tableFrom": "org_invite", + "tableTo": "app_user", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "org_invite_org_id_foreign": { + "name": "org_invite_org_id_foreign", + "tableFrom": "org_invite", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_membership": { + "name": "org_membership", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "custom_policies": { + "name": "custom_policies", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "org_membership_user_id_index": { + "name": "org_membership_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "org_membership_org_id_foreign": { + "name": "org_membership_org_id_foreign", + "tableFrom": "org_membership", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "org_membership_user_id_foreign": { + "name": "org_membership_user_id_foreign", + "tableFrom": "org_membership", + "tableTo": "app_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.pricing_configuration": { + "name": "pricing_configuration", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "reference": { + "name": "reference", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "config_session_id": { + "name": "config_session_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'in_progress'" + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "user_id": { + "name": "user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "is_internal": { + "name": "is_internal", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "locale": { + "name": "locale", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "mount": { + "name": "mount", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'app'" + }, + "wall_key": { + "name": "wall_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "org_id": { + "name": "org_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "question_set_version": { + "name": "question_set_version", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "config_shape_version": { + "name": "config_shape_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answers_raw": { + "name": "answers_raw", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "config": { + "name": "config", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "volume_bucket": { + "name": "volume_bucket", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "concurrency_bucket": { + "name": "concurrency_bucket", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "concurrency_exact": { + "name": "concurrency_exact", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "answered_count": { + "name": "answered_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "furthest_step": { + "name": "furthest_step", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "voice_transcript": { + "name": "voice_transcript", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "voice_audio": { + "name": "voice_audio", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "booking_status": { + "name": "booking_status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'none'" + }, + "booking_uid": { + "name": "booking_uid", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "booking_notified_at": { + "name": "booking_notified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "enquiry_notified_at": { + "name": "enquiry_notified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "pricing_configuration_reference_unique": { + "name": "pricing_configuration_reference_unique", + "nullsNotDistinct": false, + "columns": [ + "reference" + ] + }, + "pricing_configuration_config_session_id_unique": { + "name": "pricing_configuration_config_session_id_unique", + "nullsNotDistinct": false, + "columns": [ + "config_session_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.processing_status": { + "name": "processing_status", + "schema": "", + "columns": { + "conversation_chunk_id": { + "name": "conversation_chunk_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "event": { + "name": "event", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent": { + "name": "parent", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "processing_status_conversation_chunk_id_index": { + "name": "processing_status_conversation_chunk_id_index", + "columns": [ + { + "expression": "conversation_chunk_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "idx_processing_status_conversation_id_id": { + "name": "idx_processing_status_conversation_id_id", + "columns": [ + { + "expression": "conversation_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "processing_status_parent_index": { + "name": "processing_status_parent_index", + "columns": [ + { + "expression": "parent", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "processing_status_project_id_index": { + "name": "processing_status_project_id_index", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "processing_status_conversation_chunk_id_foreign": { + "name": "processing_status_conversation_chunk_id_foreign", + "tableFrom": "processing_status", + "tableTo": "conversation_chunk", + "columnsFrom": [ + "conversation_chunk_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "processing_status_conversation_id_foreign": { + "name": "processing_status_conversation_id_foreign", + "tableFrom": "processing_status", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "processing_status_parent_foreign": { + "name": "processing_status_parent_foreign", + "tableFrom": "processing_status", + "tableTo": "processing_status", + "columnsFrom": [ + "parent" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "processing_status_project_id_foreign": { + "name": "processing_status_project_id_foreign", + "tableFrom": "processing_status", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project": { + "name": "project", + "schema": "", + "columns": { + "anonymize_transcripts": { + "name": "anonymize_transcripts", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "context": { + "name": "context", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "conversation_ask_for_participant_name_label": { + "name": "conversation_ask_for_participant_name_label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "conversation_title_prompt": { + "name": "conversation_title_prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "default_conversation_ask_for_participant_email": { + "name": "default_conversation_ask_for_participant_email", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "default_conversation_ask_for_participant_name": { + "name": "default_conversation_ask_for_participant_name", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "default_conversation_description": { + "name": "default_conversation_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_conversation_finish_text": { + "name": "default_conversation_finish_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_conversation_title": { + "name": "default_conversation_title", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "default_conversation_transcript_prompt": { + "name": "default_conversation_transcript_prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_conversation_tutorial_slug": { + "name": "default_conversation_tutorial_slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'none'" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "enable_ai_title_and_tags": { + "name": "enable_ai_title_and_tags", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "get_reply_mode": { + "name": "get_reply_mode", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'summarize'" + }, + "get_reply_prompt": { + "name": "get_reply_prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "image_generation_model": { + "name": "image_generation_model", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'PLACEHOLDER'" + }, + "is_conversation_allowed": { + "name": "is_conversation_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "is_enhanced_audio_processing_enabled": { + "name": "is_enhanced_audio_processing_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_get_reply_enabled": { + "name": "is_get_reply_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_get_reply_cross_pollination_enabled": { + "name": "is_get_reply_cross_pollination_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "is_project_notification_subscription_allowed": { + "name": "is_project_notification_subscription_allowed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_verify_enabled": { + "name": "is_verify_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "is_verify_on_finish_enabled": { + "name": "is_verify_on_finish_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "language": { + "name": "language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "pin_order": { + "name": "pin_order", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "selected_verification_key_list": { + "name": "selected_verification_key_list", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "visibility": { + "name": "visibility", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'workspace'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "host_guide": { + "name": "host_guide", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "move_history": { + "name": "move_history", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "methodology_version_id": { + "name": "methodology_version_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_canvas_enabled": { + "name": "is_canvas_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "legal_basis": { + "name": "legal_basis", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "privacy_policy_url": { + "name": "privacy_policy_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "is_dembrane_event_cta_enabled": { + "name": "is_dembrane_event_cta_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "is_sample": { + "name": "is_sample", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sample_version": { + "name": "sample_version", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "template_key": { + "name": "template_key", + "type": "varchar(64)", + "primaryKey": false, + "notNull": false + }, + "template_version": { + "name": "template_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_directus_user_id_foreign": { + "name": "project_directus_user_id_foreign", + "tableFrom": "project", + "tableTo": "directus_users", + "columnsFrom": [ + "directus_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_methodology_version_id_foreign": { + "name": "project_methodology_version_id_foreign", + "tableFrom": "project", + "tableTo": "methodology_version", + "columnsFrom": [ + "methodology_version_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_workspace_id_foreign": { + "name": "project_workspace_id_foreign", + "tableFrom": "project", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_agentic_run": { + "name": "project_agentic_run", + "schema": "", + "columns": { + "agent_thread_id": { + "name": "agent_thread_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "last_event_seq": { + "name": "last_event_seq", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "latest_error": { + "name": "latest_error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "latest_error_code": { + "name": "latest_error_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "latest_output": { + "name": "latest_output", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_chat_id": { + "name": "project_chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'queued'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_agentic_run_project_chat_id_foreign": { + "name": "project_agentic_run_project_chat_id_foreign", + "tableFrom": "project_agentic_run", + "tableTo": "project_chat", + "columnsFrom": [ + "project_chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_agentic_run_project_id_foreign": { + "name": "project_agentic_run_project_id_foreign", + "tableFrom": "project_agentic_run", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_agentic_run_event": { + "name": "project_agentic_run_event", + "schema": "", + "columns": { + "event_type": { + "name": "event_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "project_agentic_run_id": { + "name": "project_agentic_run_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "project_agentic_run_event_run_seq_index": { + "name": "project_agentic_run_event_run_seq_index", + "columns": [ + { + "expression": "project_agentic_run_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "seq", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_agentic_run_event_project_agentic_run_id_foreign": { + "name": "project_agentic_run_event_project_agentic_run_id_foreign", + "tableFrom": "project_agentic_run_event", + "tableTo": "project_agentic_run", + "columnsFrom": [ + "project_agentic_run_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_chat": { + "name": "project_chat", + "schema": "", + "columns": { + "auto_select": { + "name": "auto_select", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "chat_mode": { + "name": "chat_mode", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "is_private": { + "name": "is_private", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "free_period_start": { + "name": "free_period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_chat_project_id_index": { + "name": "project_chat_project_id_index", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_chat_project_id_foreign": { + "name": "project_chat_project_id_foreign", + "tableFrom": "project_chat", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "project_chat_user_created_foreign": { + "name": "project_chat_user_created_foreign", + "tableFrom": "project_chat", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "project_chat_user_updated_foreign": { + "name": "project_chat_user_updated_foreign", + "tableFrom": "project_chat", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_chat_conversation": { + "name": "project_chat_conversation", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_chat_id": { + "name": "project_chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_chat_conversation_conversation_id_foreign": { + "name": "project_chat_conversation_conversation_id_foreign", + "tableFrom": "project_chat_conversation", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "project_chat_conversation_project_chat_id_foreign": { + "name": "project_chat_conversation_project_chat_id_foreign", + "tableFrom": "project_chat_conversation", + "tableTo": "project_chat", + "columnsFrom": [ + "project_chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_chat_message": { + "name": "project_chat_message", + "schema": "", + "columns": { + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "message_from": { + "name": "message_from", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_chat_id": { + "name": "project_chat_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "template_key": { + "name": "template_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tokens_count": { + "name": "tokens_count", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "project_chat_message_project_chat_id_index": { + "name": "project_chat_message_project_chat_id_index", + "columns": [ + { + "expression": "project_chat_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "project_chat_message_project_chat_id_foreign": { + "name": "project_chat_message_project_chat_id_foreign", + "tableFrom": "project_chat_message", + "tableTo": "project_chat", + "columnsFrom": [ + "project_chat_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_chat_message_conversation": { + "name": "project_chat_message_conversation", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_chat_message_id": { + "name": "project_chat_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_chat_message_conversation_conversation_id_foreign": { + "name": "project_chat_message_conversation_conversation_id_foreign", + "tableFrom": "project_chat_message_conversation", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_chat_message_conversation_project___3af13f9a_foreign": { + "name": "project_chat_message_conversation_project___3af13f9a_foreign", + "tableFrom": "project_chat_message_conversation", + "tableTo": "project_chat_message", + "columnsFrom": [ + "project_chat_message_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_chat_message_conversation_1": { + "name": "project_chat_message_conversation_1", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "project_chat_message_id": { + "name": "project_chat_message_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_chat_message_conversation_1_conversation_id_foreign": { + "name": "project_chat_message_conversation_1_conversation_id_foreign", + "tableFrom": "project_chat_message_conversation_1", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_chat_message_conversation_1_projec__225db2e8_foreign": { + "name": "project_chat_message_conversation_1_projec__225db2e8_foreign", + "tableFrom": "project_chat_message_conversation_1", + "tableTo": "project_chat_message", + "columnsFrom": [ + "project_chat_message_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_goal_revision": { + "name": "project_goal_revision", + "schema": "", + "columns": { + "chat_id": { + "name": "chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "set_by": { + "name": "set_by", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "project_goal_revision_project_id_foreign": { + "name": "project_goal_revision_project_id_foreign", + "tableFrom": "project_goal_revision", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_membership": { + "name": "project_membership", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "custom_policies": { + "name": "custom_policies", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "granted_by": { + "name": "granted_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "project_membership_granted_by_foreign": { + "name": "project_membership_granted_by_foreign", + "tableFrom": "project_membership", + "tableTo": "app_user", + "columnsFrom": [ + "granted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_membership_project_id_foreign": { + "name": "project_membership_project_id_foreign", + "tableFrom": "project_membership", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "project_membership_user_id_foreign": { + "name": "project_membership_user_id_foreign", + "tableFrom": "project_membership", + "tableTo": "app_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_report": { + "name": "project_report", + "schema": "", + "columns": { + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "error_code": { + "name": "error_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "language": { + "name": "language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scheduled_at": { + "name": "scheduled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "show_portal_link": { + "name": "show_portal_link", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'published'" + }, + "user_instructions": { + "name": "user_instructions", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'report'" + }, + "public_token": { + "name": "public_token", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "free_period_start": { + "name": "free_period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "free_account_id": { + "name": "free_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_report_project_id_foreign": { + "name": "project_report_project_id_foreign", + "tableFrom": "project_report", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_report_user_created_foreign": { + "name": "project_report_user_created_foreign", + "tableFrom": "project_report", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_report_metric": { + "name": "project_report_metric", + "schema": "", + "columns": { + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "ip": { + "name": "ip", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_report_id": { + "name": "project_report_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "project_report_metric_project_report_id_foreign": { + "name": "project_report_metric_project_report_id_foreign", + "tableFrom": "project_report_metric", + "tableTo": "project_report", + "columnsFrom": [ + "project_report_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_report_notification_participants": { + "name": "project_report_notification_participants", + "schema": "", + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "date_submitted": { + "name": "date_submitted", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "email_opt_in": { + "name": "email_opt_in", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "email_opt_out_token": { + "name": "email_opt_out_token", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_report_notification_participants_c__5f83ce3c_foreign": { + "name": "project_report_notification_participants_c__5f83ce3c_foreign", + "tableFrom": "project_report_notification_participants", + "tableTo": "conversation", + "columnsFrom": [ + "conversation_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_tag": { + "name": "project_tag", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "text": { + "name": "text", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": {}, + "foreignKeys": { + "project_tag_project_id_foreign": { + "name": "project_tag_project_id_foreign", + "tableFrom": "project_tag", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project_webhook": { + "name": "project_webhook", + "schema": "", + "columns": { + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "events": { + "name": "events", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "secret": { + "name": "secret", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'published'" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "project_webhook_project_id_foreign": { + "name": "project_webhook_project_id_foreign", + "tableFrom": "project_webhook", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "project_webhook_user_created_foreign": { + "name": "project_webhook_user_created_foreign", + "tableFrom": "project_webhook", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "project_webhook_user_updated_foreign": { + "name": "project_webhook_user_updated_foreign", + "tableFrom": "project_webhook", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.prompt_template": { + "name": "prompt_template", + "schema": "", + "columns": { + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "varchar(50)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "is_anonymous": { + "name": "is_anonymous", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_public": { + "name": "is_public", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "language": { + "name": "language", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(200)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "prompt_template_user_created_foreign": { + "name": "prompt_template_user_created_foreign", + "tableFrom": "prompt_template", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "prompt_template_workspace_id_foreign": { + "name": "prompt_template_workspace_id_foreign", + "tableFrom": "prompt_template", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.recording_overage": { + "name": "recording_overage", + "schema": "", + "columns": { + "billing_account_id": { + "name": "billing_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "cap": { + "name": "cap", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "closed_notified_at": { + "name": "closed_notified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "excess": { + "name": "excess", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "opened_by_project_id": { + "name": "opened_by_project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "opened_notified_at": { + "name": "opened_notified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "peak": { + "name": "peak", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "recording_overage_billing_account_id_foreign": { + "name": "recording_overage_billing_account_id_foreign", + "tableFrom": "recording_overage", + "tableTo": "billing_account", + "columnsFrom": [ + "billing_account_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.referral_ledger": { + "name": "referral_ledger", + "schema": "", + "columns": { + "created_by_staff_id": { + "name": "created_by_staff_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "partner_kickback_percent": { + "name": "partner_kickback_percent", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 20 + }, + "partner_team_id": { + "name": "partner_team_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "starts_at": { + "name": "starts_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "CURRENT_TIMESTAMP" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "referral_ledger_created_by_staff_id_foreign": { + "name": "referral_ledger_created_by_staff_id_foreign", + "tableFrom": "referral_ledger", + "tableTo": "app_user", + "columnsFrom": [ + "created_by_staff_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "referral_ledger_partner_team_id_foreign": { + "name": "referral_ledger_partner_team_id_foreign", + "tableFrom": "referral_ledger", + "tableTo": "org", + "columnsFrom": [ + "partner_team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "referral_ledger_workspace_id_foreign": { + "name": "referral_ledger_workspace_id_foreign", + "tableFrom": "referral_ledger", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scheduled_task": { + "name": "scheduled_task", + "schema": "", + "columns": { + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "claimed_at": { + "name": "claimed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "payload": { + "name": "payload", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "scheduled_at": { + "name": "scheduled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'scheduled'" + }, + "task_type": { + "name": "task_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'revoke_staff_support'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "scheduled_task_scheduled_at_index": { + "name": "scheduled_task_scheduled_at_index", + "columns": [ + { + "expression": "scheduled_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "scheduled_task_status_index": { + "name": "scheduled_task_status_index", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.support_access_event": { + "name": "support_access_event", + "schema": "", + "columns": { + "actor_user_id": { + "name": "actor_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "event_code": { + "name": "event_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "params": { + "name": "params", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "staff_user_id": { + "name": "staff_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "support_access_event_created_at_index": { + "name": "support_access_event_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_access_event_event_code_index": { + "name": "support_access_event_event_code_index", + "columns": [ + { + "expression": "event_code", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "support_access_event_actor_user_id_foreign": { + "name": "support_access_event_actor_user_id_foreign", + "tableFrom": "support_access_event", + "tableTo": "app_user", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "support_access_event_staff_user_id_foreign": { + "name": "support_access_event_staff_user_id_foreign", + "tableFrom": "support_access_event", + "tableTo": "app_user", + "columnsFrom": [ + "staff_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "support_access_event_workspace_id_foreign": { + "name": "support_access_event_workspace_id_foreign", + "tableFrom": "support_access_event", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.support_access_request": { + "name": "support_access_request", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "membership_id": { + "name": "membership_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "resolved_at": { + "name": "resolved_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "resolved_by": { + "name": "resolved_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "support_access_request_status_index": { + "name": "support_access_request_status_index", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "support_access_request_membership_id_foreign": { + "name": "support_access_request_membership_id_foreign", + "tableFrom": "support_access_request", + "tableTo": "workspace_membership", + "columnsFrom": [ + "membership_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "support_access_request_requested_by_foreign": { + "name": "support_access_request_requested_by_foreign", + "tableFrom": "support_access_request", + "tableTo": "app_user", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "support_access_request_resolved_by_foreign": { + "name": "support_access_request_resolved_by_foreign", + "tableFrom": "support_access_request", + "tableTo": "app_user", + "columnsFrom": [ + "resolved_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "support_access_request_workspace_id_foreign": { + "name": "support_access_request_workspace_id_foreign", + "tableFrom": "support_access_request", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.support_request": { + "name": "support_request", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "page_context": { + "name": "page_context", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_chat_id": { + "name": "project_chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'new'" + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "app_user_id": { + "name": "app_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "chat_id": { + "name": "chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "message_id": { + "name": "message_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "forwarded_at": { + "name": "forwarded_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.training": { + "name": "training", + "schema": "", + "columns": { + "base_price_eur": { + "name": "base_price_eur", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "extra_participants": { + "name": "extra_participants", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "extra_price_eur": { + "name": "extra_price_eur", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "grants_license": { + "name": "grants_license", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "included_participants": { + "name": "included_participants", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "requested_by": { + "name": "requested_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "scheduled_at": { + "name": "scheduled_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'requested'" + }, + "type": { + "name": "type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'online'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "training_org_id_foreign": { + "name": "training_org_id_foreign", + "tableFrom": "training", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "training_requested_by_foreign": { + "name": "training_requested_by_foreign", + "tableFrom": "training", + "tableTo": "app_user", + "columnsFrom": [ + "requested_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.training_license": { + "name": "training_license", + "schema": "", + "columns": { + "app_user_id": { + "name": "app_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "granted_by": { + "name": "granted_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "training_id": { + "name": "training_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "training_license_app_user_id_foreign": { + "name": "training_license_app_user_id_foreign", + "tableFrom": "training_license", + "tableTo": "app_user", + "columnsFrom": [ + "app_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "training_license_granted_by_foreign": { + "name": "training_license_granted_by_foreign", + "tableFrom": "training_license", + "tableTo": "app_user", + "columnsFrom": [ + "granted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "training_license_org_id_foreign": { + "name": "training_license_org_id_foreign", + "tableFrom": "training_license", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "training_license_training_id_foreign": { + "name": "training_license_training_id_foreign", + "tableFrom": "training_license", + "tableTo": "training", + "columnsFrom": [ + "training_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.usage_insight": { + "name": "usage_insight", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "directus_user_id": { + "name": "directus_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "insight_type": { + "name": "insight_type", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'intent'" + }, + "project_chat_id": { + "name": "project_chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "status": { + "name": "status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'new'" + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "app_user_id": { + "name": "app_user_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "chat_id": { + "name": "chat_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "message_id": { + "name": "message_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification_topic": { + "name": "verification_topic", + "schema": "", + "columns": { + "date_created": { + "name": "date_created", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "date_updated": { + "name": "date_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "icon": { + "name": "icon", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": true, + "notNull": true, + "default": "NULL" + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "user_created": { + "name": "user_created", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "user_updated": { + "name": "user_updated", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "verification_topic_project_id_foreign": { + "name": "verification_topic_project_id_foreign", + "tableFrom": "verification_topic", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "verification_topic_user_created_foreign": { + "name": "verification_topic_user_created_foreign", + "tableFrom": "verification_topic", + "tableTo": "directus_users", + "columnsFrom": [ + "user_created" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "verification_topic_user_updated_foreign": { + "name": "verification_topic_user_updated_foreign", + "tableFrom": "verification_topic", + "tableTo": "directus_users", + "columnsFrom": [ + "user_updated" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification_topic_translations": { + "name": "verification_topic_translations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "label": { + "name": "label", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "languages_code": { + "name": "languages_code", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "verification_topic_key": { + "name": "verification_topic_key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + } + }, + "indexes": {}, + "foreignKeys": { + "verification_topic_translations_languages_code_foreign": { + "name": "verification_topic_translations_languages_code_foreign", + "tableFrom": "verification_topic_translations", + "tableTo": "languages", + "columnsFrom": [ + "languages_code" + ], + "columnsTo": [ + "code" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "verification_topic_translations_verificati__34868e89_foreign": { + "name": "verification_topic_translations_verificati__34868e89_foreign", + "tableFrom": "verification_topic_translations", + "tableTo": "verification_topic", + "columnsFrom": [ + "verification_topic_key" + ], + "columnsTo": [ + "key" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace": { + "name": "workspace", + "schema": "", + "columns": { + "billed_to_team_id": { + "name": "billed_to_team_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "billed_to_workspace_id": { + "name": "billed_to_workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "effective_client_team_id": { + "name": "effective_client_team_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "handoff_status": { + "name": "handoff_status", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "handoff_target_team_id": { + "name": "handoff_target_team_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "legal_basis": { + "name": "legal_basis", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "logo_url": { + "name": "logo_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "privacy_policy_url": { + "name": "privacy_policy_url", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "settings": { + "name": "settings", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'{}'::json" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "visibility": { + "name": "visibility", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "'open_to_organisation'" + }, + "billing_account_id": { + "name": "billing_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "usage_context": { + "name": "usage_context", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "data_owner_email": { + "name": "data_owner_email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "data_owner_org_name": { + "name": "data_owner_org_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "default": "NULL" + }, + "partner_agreement_accepted_at": { + "name": "partner_agreement_accepted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "allow_support_access": { + "name": "allow_support_access", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "context": { + "name": "context", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "workspace_billed_to_team_id_foreign": { + "name": "workspace_billed_to_team_id_foreign", + "tableFrom": "workspace", + "tableTo": "org", + "columnsFrom": [ + "billed_to_team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_billed_to_workspace_id_foreign": { + "name": "workspace_billed_to_workspace_id_foreign", + "tableFrom": "workspace", + "tableTo": "workspace", + "columnsFrom": [ + "billed_to_workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_billing_account_id_foreign": { + "name": "workspace_billing_account_id_foreign", + "tableFrom": "workspace", + "tableTo": "billing_account", + "columnsFrom": [ + "billing_account_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "workspace_created_by_foreign": { + "name": "workspace_created_by_foreign", + "tableFrom": "workspace", + "tableTo": "app_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_effective_client_team_id_foreign": { + "name": "workspace_effective_client_team_id_foreign", + "tableFrom": "workspace", + "tableTo": "org", + "columnsFrom": [ + "effective_client_team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_handoff_target_team_id_foreign": { + "name": "workspace_handoff_target_team_id_foreign", + "tableFrom": "workspace", + "tableTo": "org", + "columnsFrom": [ + "handoff_target_team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_org_id_foreign": { + "name": "workspace_org_id_foreign", + "tableFrom": "workspace", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_invite": { + "name": "workspace_invite", + "schema": "", + "columns": { + "accepted_at": { + "name": "accepted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "invited_by": { + "name": "invited_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workspace_invite_deleted_at_index": { + "name": "workspace_invite_deleted_at_index", + "columns": [ + { + "expression": "deleted_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_invite_invited_by_foreign": { + "name": "workspace_invite_invited_by_foreign", + "tableFrom": "workspace_invite", + "tableTo": "app_user", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_invite_project_id_foreign": { + "name": "workspace_invite_project_id_foreign", + "tableFrom": "workspace_invite", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "workspace_invite_workspace_id_foreign": { + "name": "workspace_invite_workspace_id_foreign", + "tableFrom": "workspace_invite", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.workspace_membership": { + "name": "workspace_membership", + "schema": "", + "columns": { + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "custom_policies": { + "name": "custom_policies", + "type": "json", + "primaryKey": false, + "notNull": false, + "default": "'[]'::json" + }, + "deleted_at": { + "name": "deleted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "role": { + "name": "role", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "NULL" + }, + "source": { + "name": "source", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "default": "'direct'" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "CURRENT_TIMESTAMP" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "workspace_membership_expires_at_index": { + "name": "workspace_membership_expires_at_index", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "workspace_membership_user_id_foreign": { + "name": "workspace_membership_user_id_foreign", + "tableFrom": "workspace_membership", + "tableTo": "app_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "workspace_membership_workspace_id_foreign": { + "name": "workspace_membership_workspace_id_foreign", + "tableFrom": "workspace_membership", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account_demo": { + "name": "account_demo", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'queued'" + }, + "input": { + "name": "input", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "steps": { + "name": "steps", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "pages": { + "name": "pages", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "research": { + "name": "research", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "research_markdown": { + "name": "research_markdown", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "corpus": { + "name": "corpus", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "seed": { + "name": "seed", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "offer_document_id": { + "name": "offer_document_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "invited_at": { + "name": "invited_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "published_at": { + "name": "published_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_demo_created_at_index": { + "name": "account_demo_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_demo_org_id_foreign": { + "name": "account_demo_org_id_foreign", + "tableFrom": "account_demo", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "account_demo_status_check": { + "name": "account_demo_status_check", + "value": "\"account_demo\".\"status\" in ('queued', 'running', 'draft', 'failed', 'published')" + } + }, + "isRLSEnabled": false + }, + "public.account_document": { + "name": "account_document", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'en'" + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "supersedes_id": { + "name": "supersedes_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "reference": { + "name": "reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "template": { + "name": "template", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_key": { + "name": "file_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "page_count": { + "name": "page_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "requires_signature": { + "name": "requires_signature", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + }, + "terms_text_id": { + "name": "terms_text_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sla_text_id": { + "name": "sla_text_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "dpa_text_id": { + "name": "dpa_text_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "lines": { + "name": "lines", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "subtotal_cents": { + "name": "subtotal_cents", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "vat_cents": { + "name": "vat_cents", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "total_cents": { + "name": "total_cents", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "valid_until": { + "name": "valid_until", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "external_ref": { + "name": "external_ref", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "exact_id": { + "name": "exact_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "issued_on": { + "name": "issued_on", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "due_on": { + "name": "due_on", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "invoice_status": { + "name": "invoice_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "paid_at": { + "name": "paid_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "payment_url": { + "name": "payment_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_reference": { + "name": "payment_reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signer_email": { + "name": "signer_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signer_name": { + "name": "signer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signer_role": { + "name": "signer_role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signer_invited_at": { + "name": "signer_invited_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "sent_at": { + "name": "sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "viewed_at": { + "name": "viewed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "declined_at": { + "name": "declined_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "decline_reason": { + "name": "decline_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "voided_at": { + "name": "voided_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_document_org_id_index": { + "name": "account_document_org_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "account_document_signer_email_index": { + "name": "account_document_signer_email_index", + "columns": [ + { + "expression": "signer_email", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_document_org_id_foreign": { + "name": "account_document_org_id_foreign", + "tableFrom": "account_document", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_document_supersedes_id_foreign": { + "name": "account_document_supersedes_id_foreign", + "tableFrom": "account_document", + "tableTo": "account_document", + "columnsFrom": [ + "supersedes_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "account_document_terms_text_id_foreign": { + "name": "account_document_terms_text_id_foreign", + "tableFrom": "account_document", + "tableTo": "legal_text", + "columnsFrom": [ + "terms_text_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "account_document_sla_text_id_foreign": { + "name": "account_document_sla_text_id_foreign", + "tableFrom": "account_document", + "tableTo": "legal_text", + "columnsFrom": [ + "sla_text_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "account_document_dpa_text_id_foreign": { + "name": "account_document_dpa_text_id_foreign", + "tableFrom": "account_document", + "tableTo": "legal_text", + "columnsFrom": [ + "dpa_text_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "account_document_exact_id_unique": { + "name": "account_document_exact_id_unique", + "nullsNotDistinct": false, + "columns": [ + "exact_id" + ] + } + }, + "policies": {}, + "checkConstraints": { + "account_document_kind_check": { + "name": "account_document_kind_check", + "value": "\"account_document\".\"kind\" in ('offer', 'dpa', 'invoice', 'other')" + }, + "account_document_status_check": { + "name": "account_document_status_check", + "value": "\"account_document\".\"status\" in ('draft', 'sent', 'viewed', 'signed', 'declined', 'void')" + }, + "account_document_language_check": { + "name": "account_document_language_check", + "value": "\"account_document\".\"language\" in ('en', 'nl')" + }, + "account_document_invoice_status_check": { + "name": "account_document_invoice_status_check", + "value": "\"account_document\".\"invoice_status\" is null or \"account_document\".\"invoice_status\" in ('open', 'paid', 'overdue', 'void')" + }, + "account_document_currency_check": { + "name": "account_document_currency_check", + "value": "\"account_document\".\"currency\" is null or \"account_document\".\"currency\" ~ '^[A-Z]{3}$'" + } + }, + "isRLSEnabled": false + }, + "public.account_document_field": { + "name": "account_document_field", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "page": { + "name": "page", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "x": { + "name": "x", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "y": { + "name": "y", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "width": { + "name": "width", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "height": { + "name": "height", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "required": { + "name": "required", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "signer_role": { + "name": "signer_role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'signer'" + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort": { + "name": "sort", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "account_document_field_document_id_index": { + "name": "account_document_field_document_id_index", + "columns": [ + { + "expression": "document_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_document_field_document_id_foreign": { + "name": "account_document_field_document_id_foreign", + "tableFrom": "account_document_field", + "tableTo": "account_document", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "account_document_field_kind_check": { + "name": "account_document_field_kind_check", + "value": "\"account_document_field\".\"kind\" in ('signature', 'initials', 'name', 'role', 'date', 'text', 'checkbox')" + }, + "account_document_field_box_check": { + "name": "account_document_field_box_check", + "value": "\"account_document_field\".\"page\" >= 1 and \"account_document_field\".\"x\" between 0 and 1 and \"account_document_field\".\"y\" between 0 and 1 and \"account_document_field\".\"width\" between 0 and 1 and \"account_document_field\".\"height\" between 0 and 1" + } + }, + "isRLSEnabled": false + }, + "public.account_event": { + "name": "account_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "actor_kind": { + "name": "actor_kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subject_type": { + "name": "subject_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subject_id": { + "name": "subject_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "detail": { + "name": "detail", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_event_org_id_created_at_index": { + "name": "account_event_org_id_created_at_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_event_org_id_foreign": { + "name": "account_event_org_id_foreign", + "tableFrom": "account_event", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account_room_hint": { + "name": "account_room_hint", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "dismissed_by": { + "name": "dismissed_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "dismissed_at": { + "name": "dismissed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "account_room_hint_org_id_foreign": { + "name": "account_room_hint_org_id_foreign", + "tableFrom": "account_room_hint", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_room_hint_dismissed_by_foreign": { + "name": "account_room_hint_dismissed_by_foreign", + "tableFrom": "account_room_hint", + "tableTo": "app_user", + "columnsFrom": [ + "dismissed_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "account_room_hint_org_id_label_pk": { + "name": "account_room_hint_org_id_label_pk", + "columns": [ + "org_id", + "label" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "account_room_hint_label_check": { + "name": "account_room_hint_label_check", + "value": "\"account_room_hint\".\"label\" in ('go_ahead', 'it_security', 'privacy_ai', 'contract_purchasing')" + } + }, + "isRLSEnabled": false + }, + "public.account_room_person": { + "name": "account_room_person", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "app_user_id": { + "name": "app_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "labels": { + "name": "labels", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "other": { + "name": "other", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_granted_at": { + "name": "access_granted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "invited_by": { + "name": "invited_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "org_invite_id": { + "name": "org_invite_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "labels_answered_at": { + "name": "labels_answered_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_room_person_org_id_app_user_id_index": { + "name": "account_room_person_org_id_app_user_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "app_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_room_person_org_id_foreign": { + "name": "account_room_person_org_id_foreign", + "tableFrom": "account_room_person", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_room_person_app_user_id_foreign": { + "name": "account_room_person_app_user_id_foreign", + "tableFrom": "account_room_person", + "tableTo": "app_user", + "columnsFrom": [ + "app_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_room_person_invited_by_foreign": { + "name": "account_room_person_invited_by_foreign", + "tableFrom": "account_room_person", + "tableTo": "app_user", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "account_room_person_org_invite_id_foreign": { + "name": "account_room_person_org_invite_id_foreign", + "tableFrom": "account_room_person", + "tableTo": "org_invite", + "columnsFrom": [ + "org_invite_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "account_room_person_org_id_email_unique": { + "name": "account_room_person_org_id_email_unique", + "nullsNotDistinct": false, + "columns": [ + "org_id", + "email" + ] + } + }, + "policies": {}, + "checkConstraints": { + "account_room_person_labels_check": { + "name": "account_room_person_labels_check", + "value": "\"account_room_person\".\"labels\" <@ array['go_ahead', 'rollout', 'it_security', 'privacy_ai', 'contract_purchasing', 'staff_stakeholders']::text[]" + }, + "account_room_person_other_check": { + "name": "account_room_person_other_check", + "value": "\"account_room_person\".\"other\" is null or char_length(\"account_room_person\".\"other\") <= 80" + } + }, + "isRLSEnabled": false + }, + "public.account_signature": { + "name": "account_signature", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "document_id": { + "name": "document_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "document_version": { + "name": "document_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "signer_user_id": { + "name": "signer_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "typed_name": { + "name": "typed_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "typed_role": { + "name": "typed_role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "organisation": { + "name": "organisation", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vat_number": { + "name": "vat_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dpa_authorised": { + "name": "dpa_authorised", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "field_values": { + "name": "field_values", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "image_key": { + "name": "image_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image_sha256": { + "name": "image_sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "initials_image_key": { + "name": "initials_image_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signed_at": { + "name": "signed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "confirmation_text": { + "name": "confirmation_text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "signed_pdf_key": { + "name": "signed_pdf_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "signed_pdf_sha256": { + "name": "signed_pdf_sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "outside_via": { + "name": "outside_via", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "accepted_on": { + "name": "accepted_on", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "evidence_key": { + "name": "evidence_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "evidence_sha256": { + "name": "evidence_sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "evidence_name": { + "name": "evidence_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "evidence_type": { + "name": "evidence_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "customer_reference": { + "name": "customer_reference", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "recorded_by": { + "name": "recorded_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "slot": { + "name": "slot", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'customer'" + } + }, + "indexes": { + "account_signature_org_id_index": { + "name": "account_signature_org_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_signature_document_id_foreign": { + "name": "account_signature_document_id_foreign", + "tableFrom": "account_signature", + "tableTo": "account_document", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "account_signature_document_slot_unique": { + "name": "account_signature_document_slot_unique", + "nullsNotDistinct": false, + "columns": [ + "document_id", + "slot" + ] + } + }, + "policies": {}, + "checkConstraints": { + "account_signature_slot_check": { + "name": "account_signature_slot_check", + "value": "\"account_signature\".\"slot\" in ('customer', 'second', 'dembrane')" + }, + "account_signature_method_check": { + "name": "account_signature_method_check", + "value": "\"account_signature\".\"method\" in ('drawn', 'typed', 'uploaded', 'outside', 'presigned')" + }, + "account_signature_outside_check": { + "name": "account_signature_outside_check", + "value": "(\"account_signature\".\"method\" = 'outside') = (\"account_signature\".\"outside_via\" is not null) and (\"account_signature\".\"outside_via\" is null or (\"account_signature\".\"outside_via\" in ('order_letter', 'email', 'paper', 'own_document') and \"account_signature\".\"accepted_on\" is not null and \"account_signature\".\"evidence_key\" is not null and \"account_signature\".\"evidence_sha256\" is not null))" + }, + "account_signature_image_check": { + "name": "account_signature_image_check", + "value": "\"account_signature\".\"method\" = 'outside' or (\"account_signature\".\"method\" = 'presigned' and \"account_signature\".\"slot\" = 'dembrane') or (\"account_signature\".\"signer_user_id\" is not null and \"account_signature\".\"image_key\" is not null and \"account_signature\".\"image_sha256\" is not null)" + } + }, + "isRLSEnabled": false + }, + "public.account_task": { + "name": "account_task", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "params": { + "name": "params", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'generic'" + }, + "document_id": { + "name": "document_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "unlock_on_document_id": { + "name": "unlock_on_document_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "due_on": { + "name": "due_on", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'open'" + }, + "opened_at": { + "name": "opened_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "response_text": { + "name": "response_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_file_key": { + "name": "response_file_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "response_file_name": { + "name": "response_file_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "submitted_at": { + "name": "submitted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "submitted_by": { + "name": "submitted_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "reviewed_at": { + "name": "reviewed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reviewed_by": { + "name": "reviewed_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "review_note": { + "name": "review_note", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reminder_interval_days": { + "name": "reminder_interval_days", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "next_reminder_at": { + "name": "next_reminder_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reminders_sent": { + "name": "reminders_sent", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "account_task_org_id_index": { + "name": "account_task_org_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "account_task_org_id_status_index": { + "name": "account_task_org_id_status_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "account_task_next_reminder_at_index": { + "name": "account_task_next_reminder_at_index", + "columns": [ + { + "expression": "next_reminder_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_task_org_id_foreign": { + "name": "account_task_org_id_foreign", + "tableFrom": "account_task", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_task_document_id_foreign": { + "name": "account_task_document_id_foreign", + "tableFrom": "account_task", + "tableTo": "account_document", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "account_task_unlock_on_document_id_foreign": { + "name": "account_task_unlock_on_document_id_foreign", + "tableFrom": "account_task", + "tableTo": "account_document", + "columnsFrom": [ + "unlock_on_document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "account_task_code_or_title_check": { + "name": "account_task_code_or_title_check", + "value": "\"account_task\".\"code\" is not null or \"account_task\".\"title\" is not null" + }, + "account_task_kind_check": { + "name": "account_task_kind_check", + "value": "\"account_task\".\"kind\" in ('sign', 'billing_details', 'upload', 'generic')" + }, + "account_task_status_check": { + "name": "account_task_status_check", + "value": "\"account_task\".\"status\" in ('locked', 'open', 'submitted', 'done', 'changes_requested', 'withdrawn')" + }, + "account_task_reminder_interval_check": { + "name": "account_task_reminder_interval_check", + "value": "\"account_task\".\"reminder_interval_days\" is null or \"account_task\".\"reminder_interval_days\" between 1 and 365" + } + }, + "isRLSEnabled": false + }, + "public.legal_text": { + "name": "legal_text", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "effective_on": { + "name": "effective_on", + "type": "date", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_url": { + "name": "source_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "legal_text_kind_created_at_index": { + "name": "legal_text_kind_created_at_index", + "columns": [ + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "legal_text_kind_sha256_unique": { + "name": "legal_text_kind_sha256_unique", + "nullsNotDistinct": false, + "columns": [ + "kind", + "sha256" + ] + } + }, + "policies": {}, + "checkConstraints": { + "legal_text_kind_check": { + "name": "legal_text_kind_check", + "value": "\"legal_text\".\"kind\" in ('terms', 'sla', 'dpa')" + } + }, + "isRLSEnabled": false + }, + "public.legal_text_source": { + "name": "legal_text_source", + "schema": "", + "columns": { + "kind": { + "name": "kind", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "checked_at": { + "name": "checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.offer_template": { + "name": "offer_template", + "schema": "", + "columns": { + "template": { + "name": "template", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "greeting": { + "name": "greeting", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "intro": { + "name": "intro", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "closing": { + "name": "closing", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "columns": { + "name": "columns", + "type": "json", + "primaryKey": false, + "notNull": true + }, + "valid_days": { + "name": "valid_days", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "offer_template_template_language_pk": { + "name": "offer_template_template_language_pk", + "columns": [ + "template", + "language" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "offer_template_template_check": { + "name": "offer_template_template_check", + "value": "\"offer_template\".\"template\" in ('subscription', 'event', 'custom')" + }, + "offer_template_language_check": { + "name": "offer_template_language_check", + "value": "\"offer_template\".\"language\" in ('en', 'nl')" + } + }, + "isRLSEnabled": false + }, + "public.auth_account": { + "name": "auth_account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "auth_account_user_id_index": { + "name": "auth_account_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "auth_account_user_id_auth_user_id_fk": { + "name": "auth_account_user_id_auth_user_id_fk", + "tableFrom": "auth_account", + "tableTo": "auth_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_session": { + "name": "auth_session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "device_id": { + "name": "device_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "held": { + "name": "held", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "auth_session_user_id_index": { + "name": "auth_session_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "auth_session_user_id_auth_user_id_fk": { + "name": "auth_session_user_id_auth_user_id_fk", + "tableFrom": "auth_session", + "tableTo": "auth_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "auth_session_token_unique": { + "name": "auth_session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_sign_in_overlap": { + "name": "auth_sign_in_overlap", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "session_id": { + "name": "session_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "device_id": { + "name": "device_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "other_sessions": { + "name": "other_sessions", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "other_devices": { + "name": "other_devices", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "other_last_seen_at": { + "name": "other_last_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "replaced_at": { + "name": "replaced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "auth_sign_in_overlap_user_id_index": { + "name": "auth_sign_in_overlap_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "auth_sign_in_overlap_session_id_index": { + "name": "auth_sign_in_overlap_session_id_index", + "columns": [ + { + "expression": "session_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "auth_sign_in_overlap_user_id_auth_user_id_fk": { + "name": "auth_sign_in_overlap_user_id_auth_user_id_fk", + "tableFrom": "auth_sign_in_overlap", + "tableTo": "auth_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_two_factor": { + "name": "auth_two_factor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backup_codes": { + "name": "backup_codes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "failed_verification_count": { + "name": "failed_verification_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "auth_two_factor_user_id_index": { + "name": "auth_two_factor_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "auth_two_factor_user_id_auth_user_id_fk": { + "name": "auth_two_factor_user_id_auth_user_id_fk", + "tableFrom": "auth_two_factor", + "tableTo": "auth_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_user": { + "name": "auth_user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "two_factor_enabled": { + "name": "two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "auth_user_email_unique": { + "name": "auth_user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_verification": { + "name": "auth_verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "auth_verification_identifier_index": { + "name": "auth_verification_identifier_index", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ai_feature_rule": { + "name": "ai_feature_rule", + "schema": "", + "columns": { + "position": { + "name": "position", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "pattern": { + "name": "pattern", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "feature_group": { + "name": "feature_group", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "group_label": { + "name": "group_label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "feature": { + "name": "feature", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ai_fx_rate": { + "name": "ai_fx_rate", + "schema": "", + "columns": { + "day": { + "name": "day", + "type": "date", + "primaryKey": true, + "notNull": true + }, + "usd_to_eur": { + "name": "usd_to_eur", + "type": "numeric", + "primaryKey": false, + "notNull": true + }, + "fetched_at": { + "name": "fetched_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ai_price": { + "name": "ai_price", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "input_per_m": { + "name": "input_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "cached_input_per_m": { + "name": "cached_input_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "audio_input_per_m": { + "name": "audio_input_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "output_per_m": { + "name": "output_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "long_context_threshold": { + "name": "long_context_threshold", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "long_input_per_m": { + "name": "long_input_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "long_cached_input_per_m": { + "name": "long_cached_input_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "long_output_per_m": { + "name": "long_output_per_m", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "per_audio_second": { + "name": "per_audio_second", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "per_search_query": { + "name": "per_search_query", + "type": "numeric", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "effective_from": { + "name": "effective_from", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "ai_price_provider_model_effective_from": { + "name": "ai_price_provider_model_effective_from", + "columns": [ + { + "expression": "provider", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "model", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "effective_from", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.ai_spend_daily": { + "name": "ai_spend_daily", + "schema": "", + "columns": { + "day": { + "name": "day", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "billing_account_id": { + "name": "billing_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payer": { + "name": "payer", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unattributed'" + }, + "operation": { + "name": "operation", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "calls": { + "name": "calls", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "input_tokens": { + "name": "input_tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "output_tokens": { + "name": "output_tokens", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "cost_micro_eur": { + "name": "cost_micro_eur", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "ai_spend_daily_key": { + "name": "ai_spend_daily_key", + "columns": [ + { + "expression": "day", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "coalesce(\"billing_account_id\", '00000000-0000-0000-0000-000000000000'::uuid)", + "asc": true, + "isExpression": true, + "nulls": "last" + }, + { + "expression": "payer", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "operation", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "model", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "ai_spend_daily_billing_account_idx": { + "name": "ai_spend_daily_billing_account_idx", + "columns": [ + { + "expression": "billing_account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dbos_executor_heartbeat": { + "name": "dbos_executor_heartbeat", + "schema": "", + "columns": { + "executor_id": { + "name": "executor_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dbos_workflow_lost_worker": { + "name": "dbos_workflow_lost_worker", + "schema": "", + "columns": { + "workflow_id": { + "name": "workflow_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "queue_name": { + "name": "queue_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lost": { + "name": "lost", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "set_aside_at": { + "name": "set_aside_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.free_usage": { + "name": "free_usage", + "schema": "", + "columns": { + "billing_account_id": { + "name": "billing_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "period_start": { + "name": "period_start", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "amount": { + "name": "amount", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "free_usage_billing_account_id_period_start_key_pk": { + "name": "free_usage_billing_account_id_period_start_key_pk", + "columns": [ + "billing_account_id", + "period_start", + "key" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.host_milestone": { + "name": "host_milestone", + "schema": "", + "columns": { + "directus_user_id": { + "name": "directus_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "milestone": { + "name": "milestone", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "reached_at": { + "name": "reached_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "host_milestone_directus_user_id_milestone_pk": { + "name": "host_milestone_directus_user_id_milestone_pk", + "columns": [ + "directus_user_id", + "milestone" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.model_call": { + "name": "model_call", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "service": { + "name": "service", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "operation": { + "name": "operation", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "model_group": { + "name": "model_group", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "finish_reason": { + "name": "finish_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "attempt": { + "name": "attempt", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "fallback": { + "name": "fallback", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "ms": { + "name": "ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "input_tokens": { + "name": "input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "output_tokens": { + "name": "output_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "billing_account_id": { + "name": "billing_account_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "payer": { + "name": "payer", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unattributed'" + }, + "counted": { + "name": "counted", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cached_input_tokens": { + "name": "cached_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "audio_input_tokens": { + "name": "audio_input_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "reasoning_tokens": { + "name": "reasoning_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "audio_seconds": { + "name": "audio_seconds", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "search_queries": { + "name": "search_queries", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "usage_estimated": { + "name": "usage_estimated", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "price_missing": { + "name": "price_missing", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "cost_micro_eur": { + "name": "cost_micro_eur", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "price_id": { + "name": "price_id", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "model_call_started_at_idx": { + "name": "model_call_started_at_idx", + "columns": [ + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.platform_presence": { + "name": "platform_presence", + "schema": "", + "columns": { + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "data": { + "name": "data", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "platform_presence_scope_idx": { + "name": "platform_presence_scope_idx", + "columns": [ + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "scope", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "seen_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "platform_presence_expires_idx": { + "name": "platform_presence_expires_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "platform_presence_kind_key_pk": { + "name": "platform_presence_kind_key_pk", + "columns": [ + "kind", + "key" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.platform_rate_limit": { + "name": "platform_rate_limit", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "reset_at": { + "name": "reset_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.popcorn_tensions_cache": { + "name": "popcorn_tensions_cache", + "schema": "", + "columns": { + "loop_id": { + "name": "loop_id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "cache": { + "name": "cache", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tier_limit": { + "name": "tier_limit", + "schema": "", + "columns": { + "tier": { + "name": "tier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_by": { + "name": "updated_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "tier_limit_tier_key_pk": { + "name": "tier_limit_tier_key_pk", + "columns": [ + "tier", + "key" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.staff_audit_event": { + "name": "staff_audit_event", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "staff_user_id": { + "name": "staff_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "permission": { + "name": "permission", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "detail": { + "name": "detail", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "request_id": { + "name": "request_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "staff_audit_event_staff_user_id_index": { + "name": "staff_audit_event_staff_user_id_index", + "columns": [ + { + "expression": "staff_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "staff_audit_event_target_index": { + "name": "staff_audit_event_target_index", + "columns": [ + { + "expression": "target_type", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "staff_audit_event_created_at_index": { + "name": "staff_audit_event_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.support_ticket": { + "name": "support_ticket", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "number": { + "name": "number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "identity": { + "type": "byDefault", + "name": "support_ticket_number_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'request'" + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'account'" + }, + "org_id": { + "name": "org_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'waiting_on_dembrane'" + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "suggested_category": { + "name": "suggested_category", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "opened_by": { + "name": "opened_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "requester_user_id": { + "name": "requester_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "assignee_user_id": { + "name": "assignee_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'accounts'" + }, + "context": { + "name": "context", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "first_response_at": { + "name": "first_response_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "resolved_at": { + "name": "resolved_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "forwarded_at": { + "name": "forwarded_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "requester_seen_at": { + "name": "requester_seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "support_ticket_org_id_index": { + "name": "support_ticket_org_id_index", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_requester_user_id_index": { + "name": "support_ticket_requester_user_id_index", + "columns": [ + { + "expression": "requester_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_workspace_id_index": { + "name": "support_ticket_workspace_id_index", + "columns": [ + { + "expression": "workspace_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_assignee_user_id_index": { + "name": "support_ticket_assignee_user_id_index", + "columns": [ + { + "expression": "assignee_user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_status_updated_at_index": { + "name": "support_ticket_status_updated_at_index", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_updated_at_index": { + "name": "support_ticket_updated_at_index", + "columns": [ + { + "expression": "updated_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_created_at_index": { + "name": "support_ticket_created_at_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_resolved_at_index": { + "name": "support_ticket_resolved_at_index", + "columns": [ + { + "expression": "resolved_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_first_response_at_index": { + "name": "support_ticket_first_response_at_index", + "columns": [ + { + "expression": "first_response_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "support_ticket_unforwarded_index": { + "name": "support_ticket_unforwarded_index", + "columns": [ + { + "expression": "created_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"support_ticket\".\"forwarded_at\" is null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "support_ticket_org_id_foreign": { + "name": "support_ticket_org_id_foreign", + "tableFrom": "support_ticket", + "tableTo": "org", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "support_ticket_workspace_id_foreign": { + "name": "support_ticket_workspace_id_foreign", + "tableFrom": "support_ticket", + "tableTo": "workspace", + "columnsFrom": [ + "workspace_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "support_ticket_number_unique": { + "name": "support_ticket_number_unique", + "nullsNotDistinct": false, + "columns": [ + "number" + ] + } + }, + "policies": {}, + "checkConstraints": { + "support_ticket_status_check": { + "name": "support_ticket_status_check", + "value": "\"support_ticket\".\"status\" in ('waiting_on_dembrane', 'waiting_on_customer', 'resolved', 'open', 'closed')" + }, + "support_ticket_kind_check": { + "name": "support_ticket_kind_check", + "value": "\"support_ticket\".\"kind\" in ('request', 'feedback', 'internal')" + }, + "support_ticket_scope_check": { + "name": "support_ticket_scope_check", + "value": "\"support_ticket\".\"scope\" in ('workspace', 'account', 'unplaced', 'internal')" + }, + "support_ticket_category_check": { + "name": "support_ticket_category_check", + "value": "\"support_ticket\".\"category\" is null or \"support_ticket\".\"category\" in ('problem', 'question', 'billing', 'account_access', 'idea')" + }, + "support_ticket_suggested_category_check": { + "name": "support_ticket_suggested_category_check", + "value": "\"support_ticket\".\"suggested_category\" is null or \"support_ticket\".\"suggested_category\" in ('problem', 'question', 'billing', 'account_access', 'idea')" + }, + "support_ticket_org_scope_check": { + "name": "support_ticket_org_scope_check", + "value": "\"support_ticket\".\"org_id\" is not null or \"support_ticket\".\"scope\" in ('unplaced', 'internal')" + }, + "support_ticket_source_check": { + "name": "support_ticket_source_check", + "value": "\"support_ticket\".\"source\" in ('app', 'feedback', 'assistant', 'mcp', 'staff', 'accounts')" + } + }, + "isRLSEnabled": false + }, + "public.support_ticket_message": { + "name": "support_ticket_message", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "ticket_id": { + "name": "ticket_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "author_user_id": { + "name": "author_user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "from_staff": { + "name": "from_staff", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'public'" + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "attachments": { + "name": "attachments", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "support_ticket_message_ticket_id_index": { + "name": "support_ticket_message_ticket_id_index", + "columns": [ + { + "expression": "ticket_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "support_ticket_message_ticket_id_foreign": { + "name": "support_ticket_message_ticket_id_foreign", + "tableFrom": "support_ticket_message", + "tableTo": "support_ticket", + "columnsFrom": [ + "ticket_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": { + "support_ticket_message_visibility_check": { + "name": "support_ticket_message_visibility_check", + "value": "\"support_ticket_message\".\"visibility\" in ('public', 'internal_note')" + } + }, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": { + "public.conversation_record_transcript": { + "columns": { + "conversation_id": { + "name": "conversation_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "text": { + "name": "text", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sentences": { + "name": "sentences", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "audio_seconds": { + "name": "audio_seconds", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "name": "conversation_record_transcript", + "schema": "public", + "isExisting": true, + "materialized": false + } + }, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/dembrane/platform/packages/db/migrations/meta/_journal.json b/dembrane/platform/packages/db/migrations/meta/_journal.json index 665e0250a..f5bfd35a8 100644 --- a/dembrane/platform/packages/db/migrations/meta/_journal.json +++ b/dembrane/platform/packages/db/migrations/meta/_journal.json @@ -449,6 +449,13 @@ "when": 1796139784129, "tag": "0063_expand_support_ticket_requester_seen_at", "breakpoints": true + }, + { + "idx": 64, + "version": "7", + "when": 1796215583115, + "tag": "0064_expand_conversation_landscape", + "breakpoints": true } ] } \ No newline at end of file diff --git a/dembrane/platform/packages/db/src/index.ts b/dembrane/platform/packages/db/src/index.ts index 92c152959..39c6637aa 100644 --- a/dembrane/platform/packages/db/src/index.ts +++ b/dembrane/platform/packages/db/src/index.ts @@ -10,6 +10,16 @@ export { PREVIEW_DATABASE, withDatabase, } from "./database-name"; +export { + inLandscapeRoom, + inRoomSql, + LANDSCAPE_REVIEWS, + LANDSCAPE_STATUSES, + type LandscapeGateRow, + type LandscapeReview, + type LandscapeStatus, + usesAcceptedText, +} from "./landscape"; export { ARCHIVE_EXEMPT_ENVS, ARCHIVE_SCRIPT, diff --git a/dembrane/platform/packages/db/src/landscape.ts b/dembrane/platform/packages/db/src/landscape.ts new file mode 100644 index 000000000..2900a6d9c --- /dev/null +++ b/dembrane/platform/packages/db/src/landscape.ts @@ -0,0 +1,37 @@ +/** + * Landscape gate. Null status (legacy, `off` project, host upload) reads the transcript; a gated row + * enters room producers only once `landscape_entered_at` is set, and then only as `landscape_text`. + * Host-private reads (search, Ask, reports) are ungated and drop soft-deleted rows only. + */ + +export const LANDSCAPE_STATUSES = ["pending", "accepted", "rejected"] as const; +export type LandscapeStatus = (typeof LANDSCAPE_STATUSES)[number]; + +export const LANDSCAPE_REVIEWS = [ + "auto_approved", + "held", + "host_approved", + "host_rejected", +] as const; +export type LandscapeReview = (typeof LANDSCAPE_REVIEWS)[number]; + +export interface LandscapeGateRow { + readonly landscape_status: string | null; + readonly landscape_entered_at: string | Date | null; +} + +/** Whether a conversation may enter room producers (Map, Popcorn, Canvas, Explore). */ +export const inLandscapeRoom = (c: LandscapeGateRow): boolean => + c.landscape_status === null || c.landscape_entered_at !== null; + +/** SQL predicate matching `inLandscapeRoom` for a conversation table or alias. */ +export const inRoomSql = (alias: string): string => { + if (!/^[a-z_][a-z0-9_]*$/i.test(alias)) { + throw new Error(`Invalid SQL table alias: ${alias}`); + } + return `(${alias}.landscape_status IS NULL OR ${alias}.landscape_entered_at IS NOT NULL)`; +}; + +/** Whether a room producer reads `landscape_text` rather than `conversation_chunk.transcript` or `summary`. */ +export const usesAcceptedText = (c: { readonly landscape_status: string | null }): boolean => + c.landscape_status !== null; diff --git a/dembrane/platform/packages/db/src/schema/index.ts b/dembrane/platform/packages/db/src/schema/index.ts index 27d502c11..bdc0cfaa1 100644 --- a/dembrane/platform/packages/db/src/schema/index.ts +++ b/dembrane/platform/packages/db/src/schema/index.ts @@ -1151,6 +1151,15 @@ export const conversation = pgTable( recording_started_at: timestamp({ withTimezone: true, mode: "string" }), // When a live recording first got the AI budget stop; its grace runs from here. ai_stopped_at: timestamp({ withTimezone: true, mode: "string" }), + // Landscape gate: null landscape_status means a legacy or ungated conversation. + landscape_status: varchar({ length: 16 }), + landscape_review: varchar({ length: 16 }), + landscape_text: text(), + landscape_text_hash: varchar({ length: 64 }), + landscape_consent_version: varchar({ length: 32 }), + landscape_decided_at: timestamp({ withTimezone: true, mode: "string" }), + landscape_moderation: jsonb(), + landscape_entered_at: timestamp({ withTimezone: true, mode: "string" }), }, (table): PgTableExtraConfigValue[] => [ foreignKey({ @@ -1158,6 +1167,18 @@ export const conversation = pgTable( foreignColumns: [project.id], name: "conversation_project_id_foreign", }).onDelete("cascade"), + check( + "conversation_landscape_status", + sql`${table.landscape_status} in ('pending', 'accepted', 'rejected')`, + ), + check( + "conversation_landscape_review", + sql`${table.landscape_review} in ('auto_approved', 'held', 'host_approved', 'host_rejected')`, + ), + check( + "conversation_landscape_entry", + sql`${table.landscape_entered_at} is null or (coalesce(${table.landscape_status}, '') = 'accepted' and coalesce(${table.landscape_review}, '') in ('auto_approved', 'host_approved') and ${table.landscape_text} is not null)`, + ), ], ); diff --git a/dembrane/platform/packages/db/test/landscape.test.ts b/dembrane/platform/packages/db/test/landscape.test.ts new file mode 100644 index 000000000..1936693aa --- /dev/null +++ b/dembrane/platform/packages/db/test/landscape.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, test } from "bun:test"; +import { + inLandscapeRoom, + inRoomSql, + LANDSCAPE_REVIEWS, + LANDSCAPE_STATUSES, + usesAcceptedText, +} from "../src/landscape"; + +/** + * Evaluates a simple SQL predicate of the form + * `(. IS NULL OR . IS NOT NULL)` against a row so the pure unit + * test proves `inLandscapeRoom` and `inRoomSql` match without requiring Postgres. + */ +function evalSqlPredicate( + sqlExpr: string, + alias: string, + row: Record, +): boolean { + const outer = sqlExpr.trim(); + expect(outer.startsWith("(") && outer.endsWith(")")).toBe(true); + const inner = outer.slice(1, -1); + const clauses = inner.split(/\s+OR\s+/i); + return clauses.some((clause) => { + const match = clause + .trim() + .match(/^([a-z_][a-z0-9_]*)\.([a-z_][a-z0-9_]*)\s+IS\s+(NOT\s+)?NULL$/i); + if (!match) throw new Error(`Unexpected SQL clause: ${clause}`); + const [, tbl, col, notNull] = match; + expect(tbl).toBe(alias); + const val = row[col as string]; + return notNull ? val !== null : val === null; + }); +} + +describe("landscape gate helpers", () => { + const statuses: (string | null)[] = [null, ...LANDSCAPE_STATUSES]; + const reviews: (string | null)[] = [null, ...LANDSCAPE_REVIEWS]; + const enteredValues: (string | Date | null)[] = [ + null, + "2026-11-30T12:00:00.000Z", + new Date("2026-11-30T12:00:00.000Z"), + ]; + + test("inLandscapeRoom and inRoomSql agree across the full cross-product of states", () => { + const alias = "c"; + const expr = inRoomSql(alias); + expect(expr).toBe("(c.landscape_status IS NULL OR c.landscape_entered_at IS NOT NULL)"); + + let combinations = 0; + for (const landscape_status of statuses) { + for (const landscape_review of reviews) { + for (const landscape_entered_at of enteredValues) { + combinations++; + const row = { landscape_status, landscape_review, landscape_entered_at }; + const jsResult = inLandscapeRoom(row); + const sqlResult = evalSqlPredicate(expr, alias, row); + expect(sqlResult).toBe(jsResult); + + const expected = landscape_status === null || landscape_entered_at !== null; + expect(jsResult).toBe(expected); + } + } + } + expect(combinations).toBe(statuses.length * reviews.length * enteredValues.length); + }); + + test("usesAcceptedText is false only for ungated (null status) rows", () => { + expect(usesAcceptedText({ landscape_status: null })).toBe(false); + for (const status of LANDSCAPE_STATUSES) { + expect(usesAcceptedText({ landscape_status: status })).toBe(true); + } + }); + + test("inRoomSql formats table names and rejects unsafe aliases", () => { + expect(inRoomSql("conversation")).toBe( + "(conversation.landscape_status IS NULL OR conversation.landscape_entered_at IS NOT NULL)", + ); + for (const bad of ["", "c; drop table conversation", "c.id", "1abc", "c "]) { + expect(() => inRoomSql(bad)).toThrow(); + } + }); +}); diff --git a/dembrane/platform/packages/legacy-shape/src/directus.ts b/dembrane/platform/packages/legacy-shape/src/directus.ts index b7c27f472..c836273ca 100644 --- a/dembrane/platform/packages/legacy-shape/src/directus.ts +++ b/dembrane/platform/packages/legacy-shape/src/directus.ts @@ -7,9 +7,10 @@ const PG_TIMESTAMP = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d{2}(:?\d{2})?|Z)$/; -/** A Postgres timestamptz text value as Directus prints it: 2026-09-27T15:41:55.247Z. */ -export function isoTimestamp(v: string | null | undefined): string | null { +/** A Postgres timestamptz value as Directus prints it: 2026-09-27T15:41:55.247Z. */ +export function isoTimestamp(v: string | Date | null | undefined): string | null { if (v === null || v === undefined) return null; + if (v instanceof Date) return Number.isNaN(v.getTime()) ? null : v.toISOString(); const normal = v.replace(" ", "T").replace(/([+-]\d{2})$/, "$1:00"); const d = new Date(normal); return Number.isNaN(d.getTime()) ? v : d.toISOString(); diff --git a/dembrane/platform/packages/popcorn/src/index.ts b/dembrane/platform/packages/popcorn/src/index.ts index f2a9d92af..ee1f0a754 100644 --- a/dembrane/platform/packages/popcorn/src/index.ts +++ b/dembrane/platform/packages/popcorn/src/index.ts @@ -49,6 +49,7 @@ export { createPopcorn, dispatchNow, ensurePublicToken, + gatherTranscripts, listVersions, loadSettingsFor, type PopcornDeps, diff --git a/dembrane/platform/packages/popcorn/src/storage.ts b/dembrane/platform/packages/popcorn/src/storage.ts index 0d44757c1..4fa4a050e 100644 --- a/dembrane/platform/packages/popcorn/src/storage.ts +++ b/dembrane/platform/packages/popcorn/src/storage.ts @@ -1,5 +1,5 @@ import { newId } from "@dembrane/core"; -import type { Db } from "@dembrane/db"; +import { type Db, inRoomSql, usesAcceptedText } from "@dembrane/db"; import { scheduledTasks } from "@dembrane/queue"; import type postgres from "postgres"; import { directusTime, type Json } from "./py"; @@ -299,16 +299,45 @@ export function popcornStore(sql: Sql) { /** Conversations oldest first with their transcribed chunks, as gather_transcripts read them. */ async transcripts(projectId: string): Promise<{ conversations: Row[]; chunks: Row[] }> { - const conversations = await sql`select id, participant_name, created_at, duration - from conversation where project_id = ${projectId} and deleted_at is null + const conversations = await sql`select id, + case when landscape_status is null then participant_name else null end as participant_name, + created_at, duration, landscape_status, landscape_text + from conversation + where project_id = ${projectId} + and deleted_at is null + and ${sql.unsafe(inRoomSql("conversation"))} order by created_at`; if (!conversations.length) return { conversations: [], chunks: [] }; - const ids = conversations.map((c) => String(c.id)); - const chunks = await sql`select id, conversation_id, transcript, created_at, timestamp - from conversation_chunk - where conversation_id in ${sql(ids)} and transcript is not null - order by timestamp, created_at`; - return { conversations: [...conversations], chunks: [...chunks] }; + const ungatedIds: string[] = []; + const gatedChunks: Row[] = []; + for (const c of conversations) { + const status = (c.landscape_status as string | null) ?? null; + if (usesAcceptedText({ landscape_status: status })) { + if (c.landscape_text !== null && c.landscape_text !== undefined) { + gatedChunks.push({ + id: c.id, + conversation_id: c.id, + transcript: c.landscape_text, + created_at: c.created_at, + timestamp: c.created_at, + }); + } + } else { + ungatedIds.push(String(c.id)); + } + } + const rawChunks = ungatedIds.length + ? await sql`select ch.id, ch.conversation_id, ch.transcript, ch.created_at, ch.timestamp + from conversation_chunk ch + join conversation c on c.id = ch.conversation_id + where ch.conversation_id in ${sql(ungatedIds)} + and c.deleted_at is null + and ${sql.unsafe(inRoomSql("c"))} + and c.landscape_status is null + and ch.transcript is not null + order by ch.timestamp, ch.created_at` + : []; + return { conversations: [...conversations], chunks: [...rawChunks, ...gatedChunks] }; }, /** @@ -322,9 +351,20 @@ export function popcornStore(sql: Sql) { ): Promise<{ recording: number; finished: string[] }> { const rows = await sql`select c.id, c.is_finished from conversation c where c.project_id = ${projectId} and c.deleted_at is null - and (c.is_finished = false or (c.is_finished = true and exists ( - select 1 from conversation_chunk ch - where ch.conversation_id = c.id and btrim(ch.transcript) <> '')))`; + and ${sql.unsafe(inRoomSql("c"))} + and ( + c.is_finished = false + or ( + c.is_finished = true + and ( + (c.landscape_status is null and exists ( + select 1 from conversation_chunk ch + where ch.conversation_id = c.id and btrim(ch.transcript) <> '' + )) + or (c.landscape_status is not null and btrim(coalesce(c.landscape_text, '')) <> '') + ) + ) + )`; const finished = rows.filter((r) => r.is_finished === true).map((r) => String(r.id)); return { recording: rows.length - finished.length, finished }; },