From 7e71a61db470b10497e43bf730141657357f1f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Sat, 2 May 2026 19:02:38 +0100 Subject: [PATCH] feat(api+web): stream topic chat live over server-sent events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET /v1/topics/:name/stream opens an SSE firehose, polled server-side every 2s and streamed as `message` events. Forward-only — clients hit /messages once for backfill, then live from connect-time onward. Heartbeats every 30s keep the connection through proxies. Web chat panel reads the stream via fetch + ReadableStream so the bearer token stays in the Authorization header (EventSource can't set custom headers, which would force token-in-URL leaks). Auto- reconnect with exponential backoff. setInterval polling removed. Vercel maxDuration bumped to 300s on the catch-all API route so streams aren't cut at the 10s default. drizzle migrations/meta/ deleted — superseded by the filename- tracked custom runner in apps/broker/src/migrate.ts (c2cd67a). Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/src/app/api/[...route]/route.ts | 10 + .../web/src/modules/mesh/topic-chat-panel.tsx | 191 +- packages/api/src/modules/mesh/v1-router.ts | 132 +- .../db/migrations/meta/0000_snapshot.json | 2809 ------------- .../db/migrations/meta/0001_snapshot.json | 2821 ------------- .../db/migrations/meta/0002_snapshot.json | 2833 ------------- .../db/migrations/meta/0003_snapshot.json | 2839 ------------- .../db/migrations/meta/0004_snapshot.json | 2845 ------------- .../db/migrations/meta/0005_snapshot.json | 2851 ------------- .../db/migrations/meta/0006_snapshot.json | 2857 ------------- .../db/migrations/meta/0007_snapshot.json | 2864 ------------- .../db/migrations/meta/0008_snapshot.json | 3049 -------------- .../db/migrations/meta/0009_snapshot.json | 3237 --------------- .../db/migrations/meta/0010_snapshot.json | 3467 ---------------- .../db/migrations/meta/0011_snapshot.json | 3548 ----------------- packages/db/migrations/meta/_journal.json | 90 - 16 files changed, 288 insertions(+), 36155 deletions(-) delete mode 100644 packages/db/migrations/meta/0000_snapshot.json delete mode 100644 packages/db/migrations/meta/0001_snapshot.json delete mode 100644 packages/db/migrations/meta/0002_snapshot.json delete mode 100644 packages/db/migrations/meta/0003_snapshot.json delete mode 100644 packages/db/migrations/meta/0004_snapshot.json delete mode 100644 packages/db/migrations/meta/0005_snapshot.json delete mode 100644 packages/db/migrations/meta/0006_snapshot.json delete mode 100644 packages/db/migrations/meta/0007_snapshot.json delete mode 100644 packages/db/migrations/meta/0008_snapshot.json delete mode 100644 packages/db/migrations/meta/0009_snapshot.json delete mode 100644 packages/db/migrations/meta/0010_snapshot.json delete mode 100644 packages/db/migrations/meta/0011_snapshot.json delete mode 100644 packages/db/migrations/meta/_journal.json diff --git a/apps/web/src/app/api/[...route]/route.ts b/apps/web/src/app/api/[...route]/route.ts index 3d28808..9daa721 100644 --- a/apps/web/src/app/api/[...route]/route.ts +++ b/apps/web/src/app/api/[...route]/route.ts @@ -2,6 +2,16 @@ import { handle } from "hono/vercel"; import { appRouter } from "@turbostarter/api"; +// Streamable endpoints (e.g. /v1/topics/:name/stream SSE) need to keep +// the connection open for minutes, not the 10s default. 300s is the +// Vercel Pro ceiling; on Hobby the platform clamps to 60s and the +// client auto-reconnects via the SSE retry loop. +export const maxDuration = 300; + +// Force dynamic rendering — streaming responses can't be statically +// optimized and we don't want Next caching SSE traffic. +export const dynamic = "force-dynamic"; + const handler = handle(appRouter); export { handler as GET, diff --git a/apps/web/src/modules/mesh/topic-chat-panel.tsx b/apps/web/src/modules/mesh/topic-chat-panel.tsx index 012c83f..530ce0e 100644 --- a/apps/web/src/modules/mesh/topic-chat-panel.tsx +++ b/apps/web/src/modules/mesh/topic-chat-panel.tsx @@ -4,8 +4,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Button } from "@turbostarter/ui-web/button"; -const POLL_INTERVAL_MS = 5000; - interface TopicMessage { id: string; senderPubkey: string; @@ -69,16 +67,54 @@ function fmtTime(iso: string): string { } } -function fmtRelative(iso: string): string { - const ms = Date.now() - new Date(iso).getTime(); - if (ms < 60_000) return `${Math.floor(ms / 1000)}s ago`; - if (ms < 3_600_000) return `${Math.floor(ms / 60_000)}m ago`; - if (ms < 86_400_000) return `${Math.floor(ms / 3_600_000)}h ago`; - return new Date(iso).toLocaleDateString(); -} - const monoStyle = { fontFamily: "var(--cm-font-mono)" } as const; +type SseEvent = { + event: string; + id?: string; + data: string; +}; + +/** + * Minimal text/event-stream parser. Reads from a `fetch` body so we can + * keep the bearer token in the Authorization header — the native + * EventSource API doesn't allow custom headers, which would force us to + * pass the secret via query string and leak it into proxy/referer logs. + * + * Yields each `event:`/`id:`/`data:` block. Anything that doesn't fit + * the format (comments, blank lines, unknown fields) is skipped. + */ +async function* readSseStream( + reader: ReadableStreamDefaultReader, +): AsyncGenerator { + const decoder = new TextDecoder(); + let buffer = ""; + while (true) { + const { value, done } = await reader.read(); + if (done) break; + buffer += decoder.decode(value, { stream: true }); + let idx: number; + while ((idx = buffer.indexOf("\n\n")) !== -1) { + const block = buffer.slice(0, idx); + buffer = buffer.slice(idx + 2); + const ev: SseEvent = { event: "message", data: "" }; + const dataLines: string[] = []; + for (const line of block.split("\n")) { + if (!line || line.startsWith(":")) continue; + const colon = line.indexOf(":"); + if (colon < 0) continue; + const field = line.slice(0, colon); + const val = line.slice(colon + 1).replace(/^ /, ""); + if (field === "event") ev.event = val; + else if (field === "id") ev.id = val; + else if (field === "data") dataLines.push(val); + } + ev.data = dataLines.join("\n"); + yield ev; + } + } +} + export function TopicChatPanel({ topicName, meshSlug, @@ -89,9 +125,12 @@ export function TopicChatPanel({ const [draft, setDraft] = useState(""); const [error, setError] = useState(null); const [sending, setSending] = useState(false); - const [isFetching, setIsFetching] = useState(false); - const [lastPollAt, setLastPollAt] = useState(null); + const [streamState, setStreamState] = useState< + "connecting" | "live" | "reconnecting" | "stopped" + >("connecting"); + const [lastEventAt, setLastEventAt] = useState(null); const scrollRef = useRef(null); + const seenIdsRef = useRef>(new Set()); const headers = useMemo( () => ({ @@ -101,8 +140,9 @@ export function TopicChatPanel({ [apiKeySecret], ); - const refresh = useCallback(async () => { - setIsFetching(true); + // One-shot history backfill on mount; the SSE stream is forward-only, + // so any messages older than connect-time come from this fetch. + const loadHistory = useCallback(async () => { try { const res = await fetch( `/api/v1/topics/${encodeURIComponent(topicName)}/messages?limit=100`, @@ -113,21 +153,90 @@ export function TopicChatPanel({ return; } const json = (await res.json()) as { messages: TopicMessage[] }; - setMessages(json.messages.slice().reverse()); + const ordered = json.messages.slice().reverse(); + for (const m of ordered) seenIdsRef.current.add(m.id); + setMessages(ordered); setError(null); - setLastPollAt(Date.now()); } catch (e) { setError((e as Error).message); - } finally { - setIsFetching(false); } }, [headers, topicName]); useEffect(() => { - void refresh(); - const t = setInterval(refresh, POLL_INTERVAL_MS); - return () => clearInterval(t); - }, [refresh]); + void loadHistory(); + }, [loadHistory]); + + // SSE subscription with auto-reconnect. AbortController unwinds the + // stream when the component unmounts or the topic/key changes. + useEffect(() => { + const ctl = new AbortController(); + let cancelled = false; + let backoffMs = 1000; + + const run = async () => { + while (!cancelled) { + try { + setStreamState((prev) => + prev === "live" ? "reconnecting" : "connecting", + ); + const res = await fetch( + `/api/v1/topics/${encodeURIComponent(topicName)}/stream`, + { + headers: { Authorization: `Bearer ${apiKeySecret}` }, + signal: ctl.signal, + cache: "no-store", + }, + ); + if (!res.ok || !res.body) { + throw new Error(`stream open failed: ${res.status}`); + } + backoffMs = 1000; + setStreamState("live"); + const reader = res.body.getReader(); + for await (const ev of readSseStream(reader)) { + setLastEventAt(Date.now()); + if (ev.event === "ready") continue; + if (ev.event === "heartbeat") continue; + if (ev.event === "error") { + try { + const parsed = JSON.parse(ev.data) as { error?: string }; + setError(parsed.error ?? "stream error"); + } catch { + setError("stream error"); + } + continue; + } + if (ev.event === "message") { + try { + const m = JSON.parse(ev.data) as TopicMessage; + if (seenIdsRef.current.has(m.id)) continue; + seenIdsRef.current.add(m.id); + setMessages((cur) => [...cur, m]); + } catch { + // Drop malformed events silently — heartbeat-as-message + // happens once per misconfigured proxy. + } + } + } + // Reader exhausted (server closed) — loop will reconnect. + } catch (e) { + if (cancelled || ctl.signal.aborted) return; + setError(`stream: ${(e as Error).message}`); + } + if (cancelled) return; + setStreamState("reconnecting"); + await new Promise((r) => setTimeout(r, backoffMs)); + backoffMs = Math.min(backoffMs * 2, 15_000); + } + }; + + void run(); + return () => { + cancelled = true; + setStreamState("stopped"); + ctl.abort(); + }; + }, [apiKeySecret, topicName]); useEffect(() => { scrollRef.current?.scrollTo({ @@ -154,7 +263,7 @@ export function TopicChatPanel({ return; } setDraft(""); - void refresh(); + // SSE stream will deliver the message back; no manual refresh. } catch (e) { setError((e as Error).message); } finally { @@ -162,10 +271,26 @@ export function TopicChatPanel({ } }; - const secondsSincePoll = lastPollAt - ? Math.max(0, Math.floor((Date.now() - lastPollAt) / 1000)) + const secondsSinceEvent = lastEventAt + ? Math.max(0, Math.floor((Date.now() - lastEventAt) / 1000)) : null; + const dotClass = + streamState === "live" + ? "bg-emerald-500" + : streamState === "stopped" + ? "bg-[var(--cm-fg-tertiary)]" + : "bg-[var(--cm-clay)] animate-pulse"; + + const stateLabel = + streamState === "live" + ? `live · ${secondsSinceEvent ?? 0}s` + : streamState === "connecting" + ? "connecting…" + : streamState === "reconnecting" + ? "reconnecting…" + : "stopped"; + return (
{/* Header — mono strip, clay-pulse dot, metadata right */} @@ -174,23 +299,13 @@ export function TopicChatPanel({ style={monoStyle} >
- + #{topicName}
- {messages.length} msg ·{" "} - {isFetching - ? "polling…" - : `${secondsSincePoll ?? "—"}s ago`} + {messages.length} msg · {stateLabel}
@@ -275,7 +390,7 @@ export function TopicChatPanel({ mesh · {meshSlug} - polling every {POLL_INTERVAL_MS / 1000}s + SSE · 2s push key valid until {fmtTime(apiKeyExpiresAt)} v0.2.0 · plaintext base64 · per-topic crypto in v0.3.0 diff --git a/packages/api/src/modules/mesh/v1-router.ts b/packages/api/src/modules/mesh/v1-router.ts index a1aa155..d0de74e 100644 --- a/packages/api/src/modules/mesh/v1-router.ts +++ b/packages/api/src/modules/mesh/v1-router.ts @@ -6,20 +6,24 @@ * for mesh A cannot read or write mesh B. * * Endpoints (v0.2.0 minimum): - * POST /v1/messages — send to a topic - * GET /v1/topics — list topics in the key's mesh - * GET /v1/topics/:name/messages — fetch topic history (paginated) - * GET /v1/peers — list peers in the mesh + * POST /v1/messages — send to a topic + * GET /v1/topics — list topics in the key's mesh + * GET /v1/topics/:name/messages — fetch topic history (paginated) + * GET /v1/topics/:name/stream — SSE: live message firehose for a topic + * PATCH /v1/topics/:name/read — mark a topic read up to now + * GET /v1/peers — list peers in the mesh * * Live delivery: writes to mesh.message_queue + mesh.topic_message. The * broker's existing pendingTimer drains the queue and pushes to live - * peers. Latency = polling interval (~2s today). Real-time push from - * REST writes is a follow-up. + * peers. The /stream endpoint server-side polls topic_message every + * 2s and pushes new rows as SSE events — clients see new messages + * within 2s without burning a poll-per-tab. * * Spec: .artifacts/specs/2026-05-02-v0.2.0-scope.md */ import { Hono } from "hono"; +import { streamSSE } from "hono/streaming"; import { z } from "zod"; import { db } from "@turbostarter/db/server"; @@ -32,7 +36,7 @@ import { messageQueue, presence, } from "@turbostarter/db/schema/mesh"; -import { and, asc, desc, eq, isNull, lt } from "drizzle-orm"; +import { and, asc, desc, eq, gt, isNull, lt } from "drizzle-orm"; import { validate } from "../../middleware"; import { @@ -239,6 +243,120 @@ export const v1Router = new Hono() }, ) + // GET /v1/topics/:name/stream — live SSE firehose for a topic. + // + // Server-side polls mesh.topic_message every STREAM_POLL_MS for rows + // newer than the last seen createdAt and pushes each as an SSE + // `message` event. First connection sample establishes the watermark + // (no historical replay — clients fetch /messages for that). The + // stream ends when the client disconnects or the topic is archived. + // + // Heartbeats every 30s as SSE comments (`:keep-alive`) keep the + // connection through proxies that drop idle TCP. Postgres LISTEN/ + // NOTIFY is the obvious upgrade path when message volume grows; the + // poll loop here is fine for v0.2.0's low write rate. + .get("/topics/:name/stream", async (c) => { + const key = c.var.apiKey; + requireCapability(key, "read"); + const name = c.req.param("name"); + requireTopicScope(key, name); + + const [topic] = await db + .select({ id: meshTopic.id }) + .from(meshTopic) + .where( + and( + eq(meshTopic.meshId, key.meshId), + eq(meshTopic.name, name), + isNull(meshTopic.archivedAt), + ), + ); + if (!topic) { + return c.json({ error: "topic_not_found", topic: name }, 404); + } + + const STREAM_POLL_MS = 2000; + const HEARTBEAT_MS = 30_000; + + return streamSSE(c, async (stream) => { + // Watermark: skip messages older than connect time so we don't + // replay history. Clients backfill via GET /messages. + let cursor = new Date(); + let lastHeartbeat = Date.now(); + let aborted = false; + + stream.onAbort(() => { + aborted = true; + }); + + // Initial hello so clients know the stream is alive. + await stream.writeSSE({ + event: "ready", + data: JSON.stringify({ + topic: name, + topicId: topic.id, + connectedAt: cursor.toISOString(), + }), + }); + + while (!aborted) { + try { + const rows = await db + .select({ + id: meshTopicMessage.id, + senderPubkey: meshMember.peerPubkey, + senderName: meshMember.displayName, + nonce: meshTopicMessage.nonce, + ciphertext: meshTopicMessage.ciphertext, + createdAt: meshTopicMessage.createdAt, + }) + .from(meshTopicMessage) + .innerJoin( + meshMember, + eq(meshTopicMessage.senderMemberId, meshMember.id), + ) + .where( + and( + eq(meshTopicMessage.topicId, topic.id), + gt(meshTopicMessage.createdAt, cursor), + ), + ) + .orderBy(asc(meshTopicMessage.createdAt)) + .limit(100); + + for (const r of rows) { + await stream.writeSSE({ + event: "message", + id: r.id, + data: JSON.stringify({ + id: r.id, + senderPubkey: r.senderPubkey, + senderName: r.senderName, + nonce: r.nonce, + ciphertext: r.ciphertext, + createdAt: r.createdAt.toISOString(), + }), + }); + if (r.createdAt > cursor) cursor = r.createdAt; + } + + if (Date.now() - lastHeartbeat > HEARTBEAT_MS) { + await stream.writeSSE({ event: "heartbeat", data: String(Date.now()) }); + lastHeartbeat = Date.now(); + } + } catch (e) { + await stream.writeSSE({ + event: "error", + data: JSON.stringify({ + error: e instanceof Error ? e.message : String(e), + }), + }); + } + await stream.sleep(STREAM_POLL_MS); + } + }); + }) + // GET /v1/peers — connected peers in the key's mesh // Dedupe by memberId — a member can have multiple active presence // rows (one per session). Status reflects the most recent presence; diff --git a/packages/db/migrations/meta/0000_snapshot.json b/packages/db/migrations/meta/0000_snapshot.json deleted file mode 100644 index 3e4de35..0000000 --- a/packages/db/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,2809 +0,0 @@ -{ - "id": "a1b0192f-d300-48eb-8f1d-e76c65b030dc", - "prevId": "00000000-0000-0000-0000-000000000000", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0001_snapshot.json b/packages/db/migrations/meta/0001_snapshot.json deleted file mode 100644 index 6edccb8..0000000 --- a/packages/db/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,2821 +0,0 @@ -{ - "id": "dcec14c1-d1b1-4371-a9ad-d004839ed856", - "prevId": "a1b0192f-d300-48eb-8f1d-e76c65b030dc", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0002_snapshot.json b/packages/db/migrations/meta/0002_snapshot.json deleted file mode 100644 index 2c2e0bc..0000000 --- a/packages/db/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,2833 +0,0 @@ -{ - "id": "e288fab9-4732-43d6-938e-3cda71417932", - "prevId": "dcec14c1-d1b1-4371-a9ad-d004839ed856", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0003_snapshot.json b/packages/db/migrations/meta/0003_snapshot.json deleted file mode 100644 index 197b415..0000000 --- a/packages/db/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,2839 +0,0 @@ -{ - "id": "850dbb6a-6bec-415b-a364-66c637bb5207", - "prevId": "e288fab9-4732-43d6-938e-3cda71417932", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0004_snapshot.json b/packages/db/migrations/meta/0004_snapshot.json deleted file mode 100644 index 342e5a5..0000000 --- a/packages/db/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,2845 +0,0 @@ -{ - "id": "63ac21bd-0e0c-472a-824c-3411707ce0f3", - "prevId": "850dbb6a-6bec-415b-a364-66c637bb5207", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0005_snapshot.json b/packages/db/migrations/meta/0005_snapshot.json deleted file mode 100644 index ba353cf..0000000 --- a/packages/db/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,2851 +0,0 @@ -{ - "id": "5a1e3fa4-a569-41d8-86d6-fc7ff1bef8ad", - "prevId": "63ac21bd-0e0c-472a-824c-3411707ce0f3", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0006_snapshot.json b/packages/db/migrations/meta/0006_snapshot.json deleted file mode 100644 index a082ae8..0000000 --- a/packages/db/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,2857 +0,0 @@ -{ - "id": "07e97bf7-468e-4ccf-b641-4f5f16fb6c83", - "prevId": "5a1e3fa4-a569-41d8-86d6-fc7ff1bef8ad", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0007_snapshot.json b/packages/db/migrations/meta/0007_snapshot.json deleted file mode 100644 index 97d23b1..0000000 --- a/packages/db/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,2864 +0,0 @@ -{ - "id": "65a6e5a0-9eba-4b7b-93bc-2f0c9e0f91c8", - "prevId": "07e97bf7-468e-4ccf-b641-4f5f16fb6c83", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "groups": { - "name": "groups", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'[]'::jsonb" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0008_snapshot.json b/packages/db/migrations/meta/0008_snapshot.json deleted file mode 100644 index efab44b..0000000 --- a/packages/db/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,3049 +0,0 @@ -{ - "id": "c7ccc82a-517e-4ebe-b467-89ff66306354", - "prevId": "65a6e5a0-9eba-4b7b-93bc-2f0c9e0f91c8", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.memory": { - "name": "memory", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "remembered_by": { - "name": "remembered_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_by_name": { - "name": "remembered_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_at": { - "name": "remembered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "forgotten_at": { - "name": "forgotten_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "memory_mesh_id_mesh_id_fk": { - "name": "memory_mesh_id_mesh_id_fk", - "tableFrom": "memory", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "memory_remembered_by_member_id_fk": { - "name": "memory_remembered_by_member_id_fk", - "tableFrom": "memory", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "remembered_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.state": { - "name": "state", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "updated_by_presence": { - "name": "updated_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_name": { - "name": "updated_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "state_mesh_key_idx": { - "name": "state_mesh_key_idx", - "columns": [ - { - "expression": "mesh_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "state_mesh_id_mesh_id_fk": { - "name": "state_mesh_id_mesh_id_fk", - "tableFrom": "state", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "groups": { - "name": "groups", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'[]'::jsonb" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0009_snapshot.json b/packages/db/migrations/meta/0009_snapshot.json deleted file mode 100644 index 30da6a2..0000000 --- a/packages/db/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,3237 +0,0 @@ -{ - "id": "cced9051-7468-4428-8d46-472edd5f4509", - "prevId": "c7ccc82a-517e-4ebe-b467-89ff66306354", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file": { - "name": "file", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "minio_key": { - "name": "minio_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "persistent": { - "name": "persistent", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_by_member": { - "name": "uploaded_by_member", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "file_mesh_id_mesh_id_fk": { - "name": "file_mesh_id_mesh_id_fk", - "tableFrom": "file", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "file_uploaded_by_member_member_id_fk": { - "name": "file_uploaded_by_member_member_id_fk", - "tableFrom": "file", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "uploaded_by_member" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file_access": { - "name": "file_access", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "file_id": { - "name": "file_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "peer_session_pubkey": { - "name": "peer_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_name": { - "name": "peer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accessed_at": { - "name": "accessed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "file_access_file_id_file_id_fk": { - "name": "file_access_file_id_file_id_fk", - "tableFrom": "file_access", - "tableTo": "file", - "schemaTo": "mesh", - "columnsFrom": [ - "file_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.memory": { - "name": "memory", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "remembered_by": { - "name": "remembered_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_by_name": { - "name": "remembered_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_at": { - "name": "remembered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "forgotten_at": { - "name": "forgotten_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "memory_mesh_id_mesh_id_fk": { - "name": "memory_mesh_id_mesh_id_fk", - "tableFrom": "memory", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "memory_remembered_by_member_id_fk": { - "name": "memory_remembered_by_member_id_fk", - "tableFrom": "memory", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "remembered_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.state": { - "name": "state", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "updated_by_presence": { - "name": "updated_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_name": { - "name": "updated_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "state_mesh_key_idx": { - "name": "state_mesh_key_idx", - "columns": [ - { - "expression": "mesh_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "state_mesh_id_mesh_id_fk": { - "name": "state_mesh_id_mesh_id_fk", - "tableFrom": "state", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "groups": { - "name": "groups", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'[]'::jsonb" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0010_snapshot.json b/packages/db/migrations/meta/0010_snapshot.json deleted file mode 100644 index cb12fcb..0000000 --- a/packages/db/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,3467 +0,0 @@ -{ - "id": "44001cdd-a307-4f03-9ba1-41b6ffefa574", - "prevId": "cced9051-7468-4428-8d46-472edd5f4509", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.context": { - "name": "context", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "presence_id": { - "name": "presence_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_name": { - "name": "peer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "files_read": { - "name": "files_read", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "key_findings": { - "name": "key_findings", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "context_mesh_id_mesh_id_fk": { - "name": "context_mesh_id_mesh_id_fk", - "tableFrom": "context", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "context_presence_id_presence_id_fk": { - "name": "context_presence_id_presence_id_fk", - "tableFrom": "context", - "tableTo": "presence", - "schemaTo": "mesh", - "columnsFrom": [ - "presence_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file": { - "name": "file", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "minio_key": { - "name": "minio_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "persistent": { - "name": "persistent", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_by_member": { - "name": "uploaded_by_member", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "file_mesh_id_mesh_id_fk": { - "name": "file_mesh_id_mesh_id_fk", - "tableFrom": "file", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "file_uploaded_by_member_member_id_fk": { - "name": "file_uploaded_by_member_member_id_fk", - "tableFrom": "file", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "uploaded_by_member" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file_access": { - "name": "file_access", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "file_id": { - "name": "file_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "peer_session_pubkey": { - "name": "peer_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_name": { - "name": "peer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accessed_at": { - "name": "accessed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "file_access_file_id_file_id_fk": { - "name": "file_access_file_id_file_id_fk", - "tableFrom": "file_access", - "tableTo": "file", - "schemaTo": "mesh", - "columnsFrom": [ - "file_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.memory": { - "name": "memory", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "remembered_by": { - "name": "remembered_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_by_name": { - "name": "remembered_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_at": { - "name": "remembered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "forgotten_at": { - "name": "forgotten_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "memory_mesh_id_mesh_id_fk": { - "name": "memory_mesh_id_mesh_id_fk", - "tableFrom": "memory", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "memory_remembered_by_member_id_fk": { - "name": "memory_remembered_by_member_id_fk", - "tableFrom": "memory", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "remembered_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.state": { - "name": "state", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "updated_by_presence": { - "name": "updated_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_name": { - "name": "updated_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "state_mesh_key_idx": { - "name": "state_mesh_key_idx", - "columns": [ - { - "expression": "mesh_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "state_mesh_id_mesh_id_fk": { - "name": "state_mesh_id_mesh_id_fk", - "tableFrom": "state", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.task": { - "name": "task", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "assignee": { - "name": "assignee", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_by_name": { - "name": "claimed_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_by_presence": { - "name": "claimed_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "priority": { - "name": "priority", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'normal'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "result": { - "name": "result", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_name": { - "name": "created_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "claimed_at": { - "name": "claimed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "task_mesh_id_mesh_id_fk": { - "name": "task_mesh_id_mesh_id_fk", - "tableFrom": "task", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "task_claimed_by_presence_presence_id_fk": { - "name": "task_claimed_by_presence_presence_id_fk", - "tableFrom": "task", - "tableTo": "presence", - "schemaTo": "mesh", - "columnsFrom": [ - "claimed_by_presence" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "groups": { - "name": "groups", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'[]'::jsonb" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/0011_snapshot.json b/packages/db/migrations/meta/0011_snapshot.json deleted file mode 100644 index 6fb03e6..0000000 --- a/packages/db/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,3548 +0,0 @@ -{ - "id": "f4e49724-34ae-4772-8786-2ffd54499b9e", - "prevId": "44001cdd-a307-4f03-9ba1-41b6ffefa574", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.account": { - "name": "account", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "account_id": { - "name": "account_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_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", - "primaryKey": false, - "notNull": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "timestamp", - "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", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "account_userId_idx": { - "name": "account_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "account_user_id_user_id_fk": { - "name": "account_user_id_user_id_fk", - "tableFrom": "account", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.invitation": { - "name": "invitation", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "inviter_id": { - "name": "inviter_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "invitation_organizationId_idx": { - "name": "invitation_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "invitation_email_idx": { - "name": "invitation_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "invitation_organization_id_organization_id_fk": { - "name": "invitation_organization_id_organization_id_fk", - "tableFrom": "invitation", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "invitation_inviter_id_user_id_fk": { - "name": "invitation_inviter_id_user_id_fk", - "tableFrom": "invitation", - "tableTo": "user", - "columnsFrom": [ - "inviter_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.member": { - "name": "member", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "member_organizationId_idx": { - "name": "member_organizationId_idx", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "member_userId_idx": { - "name": "member_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "member_organization_id_organization_id_fk": { - "name": "member_organization_id_organization_id_fk", - "tableFrom": "member", - "tableTo": "organization", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organization": { - "name": "organization", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "logo": { - "name": "logo", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organization_slug_unique": { - "name": "organization_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkey": { - "name": "passkey", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "counter": { - "name": "counter", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "device_type": { - "name": "device_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backed_up": { - "name": "backed_up", - "type": "boolean", - "primaryKey": false, - "notNull": true - }, - "transports": { - "name": "transports", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "aaguid": { - "name": "aaguid", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "passkey_userId_idx": { - "name": "passkey_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "passkey_credentialID_idx": { - "name": "passkey_credentialID_idx", - "columns": [ - { - "expression": "credential_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "passkey_user_id_user_id_fk": { - "name": "passkey_user_id_user_id_fk", - "tableFrom": "passkey", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.session": { - "name": "session", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "impersonated_by": { - "name": "impersonated_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "active_organization_id": { - "name": "active_organization_id", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "session_userId_idx": { - "name": "session_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "session_user_id_user_id_fk": { - "name": "session_user_id_user_id_fk", - "tableFrom": "session", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "session_token_unique": { - "name": "session_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.two_factor": { - "name": "two_factor", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "backup_codes": { - "name": "backup_codes", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "twoFactor_secret_idx": { - "name": "twoFactor_secret_idx", - "columns": [ - { - "expression": "secret", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "twoFactor_userId_idx": { - "name": "twoFactor_userId_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "two_factor_user_id_user_id_fk": { - "name": "two_factor_user_id_user_id_fk", - "tableFrom": "two_factor", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.user": { - "name": "user", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "two_factor_enabled": { - "name": "two_factor_enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "is_anonymous": { - "name": "is_anonymous", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "banned": { - "name": "banned", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "ban_reason": { - "name": "ban_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "ban_expires": { - "name": "ban_expires", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "user_email_unique": { - "name": "user_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.verification": { - "name": "verification", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "identifier": { - "name": "identifier", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "verification_identifier_idx": { - "name": "verification_identifier_idx", - "columns": [ - { - "expression": "identifier", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.credit_transaction": { - "name": "credit_transaction", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "amount": { - "name": "amount", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "credit_transaction_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "balance_after": { - "name": "balance_after", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "credit_transaction_customer_id_customer_id_fk": { - "name": "credit_transaction_customer_id_customer_id_fk", - "tableFrom": "credit_transaction", - "tableTo": "customer", - "columnsFrom": [ - "customer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.customer": { - "name": "customer", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "customer_id": { - "name": "customer_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "plan": { - "name": "plan", - "type": "plan", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "credits": { - "name": "credits", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 100 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "customer_user_id_user_id_fk": { - "name": "customer_user_id_user_id_fk", - "tableFrom": "customer", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "customer_userId_unique": { - "name": "customer_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "customer_customerId_unique": { - "name": "customer_customerId_unique", - "nullsNotDistinct": false, - "columns": [ - "customer_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.chat": { - "name": "chat", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.message": { - "name": "message", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "chat", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "chat", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "chat.part": { - "name": "part", - "schema": "chat", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "message_id": { - "name": "message_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "details": { - "name": "details", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "part_message_id_message_id_fk": { - "name": "part_message_id_message_id_fk", - "tableFrom": "part", - "tableTo": "message", - "schemaTo": "chat", - "columnsFrom": [ - "message_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.chat": { - "name": "chat", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "chat_user_id_user_id_fk": { - "name": "chat_user_id_user_id_fk", - "tableFrom": "chat", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.citation_unit": { - "name": "citation_unit", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "retrieval_chunk_id": { - "name": "retrieval_chunk_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "paragraph_index": { - "name": "paragraph_index", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "bbox_x": { - "name": "bbox_x", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_y": { - "name": "bbox_y", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_width": { - "name": "bbox_width", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "bbox_height": { - "name": "bbox_height", - "type": "real", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "unit_type": { - "name": "unit_type", - "type": "unit_type", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_cu_document": { - "name": "idx_cu_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_retrieval": { - "name": "idx_cu_retrieval", - "columns": [ - { - "expression": "retrieval_chunk_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_page": { - "name": "idx_cu_page", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_cu_unique": { - "name": "idx_cu_unique", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "page_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "paragraph_index", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "citation_unit_document_id_document_id_fk": { - "name": "citation_unit_document_id_document_id_fk", - "tableFrom": "citation_unit", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": { - "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk", - "tableFrom": "citation_unit", - "tableTo": "retrieval_chunk", - "schemaTo": "pdf", - "columnsFrom": [ - "retrieval_chunk_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.document": { - "name": "document", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "processing_status": { - "name": "processing_status", - "type": "processing_status", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true, - "default": "'pending'" - }, - "processing_error": { - "name": "processing_error", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_chat_id_chat_id_fk": { - "name": "document_chat_id_chat_id_fk", - "tableFrom": "document", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.embedding": { - "name": "embedding", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": true - }, - "page_number": { - "name": "page_number", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_start": { - "name": "char_start", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "char_end": { - "name": "char_end", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "pdf_embeddingIndex": { - "name": "pdf_embeddingIndex", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "embedding_document_id_document_id_fk": { - "name": "embedding_document_id_document_id_fk", - "tableFrom": "embedding", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.message": { - "name": "message", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "chat_id": { - "name": "chat_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "pdf", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "message_chat_id_chat_id_fk": { - "name": "message_chat_id_chat_id_fk", - "tableFrom": "message", - "tableTo": "chat", - "schemaTo": "pdf", - "columnsFrom": [ - "chat_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "pdf.retrieval_chunk": { - "name": "retrieval_chunk", - "schema": "pdf", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "embedding": { - "name": "embedding", - "type": "vector(1536)", - "primaryKey": false, - "notNull": false - }, - "page_start": { - "name": "page_start", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "page_end": { - "name": "page_end", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "section_hierarchy": { - "name": "section_hierarchy", - "type": "text[]", - "primaryKey": false, - "notNull": false - }, - "chunk_type": { - "name": "chunk_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "default": "'prose'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": { - "idx_rc_document": { - "name": "idx_rc_document", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "idx_rc_embedding": { - "name": "idx_rc_embedding", - "columns": [ - { - "expression": "embedding", - "isExpression": false, - "asc": true, - "nulls": "last", - "opclass": "vector_cosine_ops" - } - ], - "isUnique": false, - "concurrently": false, - "method": "hnsw", - "with": {} - } - }, - "foreignKeys": { - "retrieval_chunk_document_id_document_id_fk": { - "name": "retrieval_chunk_document_id_document_id_fk", - "tableFrom": "retrieval_chunk", - "tableTo": "document", - "schemaTo": "pdf", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.generation": { - "name": "generation", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "prompt": { - "name": "prompt", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "model": { - "name": "model", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "aspect_ratio": { - "name": "aspect_ratio", - "type": "aspect_ratio", - "typeSchema": "image", - "primaryKey": false, - "notNull": true, - "default": "'square'" - }, - "count": { - "name": "count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "generation_user_id_user_id_fk": { - "name": "generation_user_id_user_id_fk", - "tableFrom": "generation", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "image.image": { - "name": "image", - "schema": "image", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "generation_id": { - "name": "generation_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "image_generation_id_generation_id_fk": { - "name": "image_generation_id_generation_id_fk", - "tableFrom": "image", - "tableTo": "generation", - "schemaTo": "image", - "columnsFrom": [ - "generation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.audit_log": { - "name": "audit_log", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "actor_peer_id": { - "name": "actor_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_peer_id": { - "name": "target_peer_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "metadata": { - "name": "metadata", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "audit_log_mesh_id_mesh_id_fk": { - "name": "audit_log_mesh_id_mesh_id_fk", - "tableFrom": "audit_log", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.invite": { - "name": "invite", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "token_bytes": { - "name": "token_bytes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "used_count": { - "name": "used_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "invite_mesh_id_mesh_id_fk": { - "name": "invite_mesh_id_mesh_id_fk", - "tableFrom": "invite", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "invite_created_by_user_id_fk": { - "name": "invite_created_by_user_id_fk", - "tableFrom": "invite", - "tableTo": "user", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "invite_token_unique": { - "name": "invite_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.mesh": { - "name": "mesh", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "owner_user_id": { - "name": "owner_user_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "visibility": { - "name": "visibility", - "type": "visibility", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'private'" - }, - "transport": { - "name": "transport", - "type": "transport", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'managed'" - }, - "max_peers": { - "name": "max_peers", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tier": { - "name": "tier", - "type": "tier", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'free'" - }, - "owner_pubkey": { - "name": "owner_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "owner_secret_key": { - "name": "owner_secret_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "root_key": { - "name": "root_key", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "archived_at": { - "name": "archived_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "mesh_owner_user_id_user_id_fk": { - "name": "mesh_owner_user_id_user_id_fk", - "tableFrom": "mesh", - "tableTo": "user", - "columnsFrom": [ - "owner_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "mesh_slug_unique": { - "name": "mesh_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.context": { - "name": "context", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "presence_id": { - "name": "presence_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_name": { - "name": "peer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "files_read": { - "name": "files_read", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "key_findings": { - "name": "key_findings", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "context_mesh_id_mesh_id_fk": { - "name": "context_mesh_id_mesh_id_fk", - "tableFrom": "context", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "context_presence_id_presence_id_fk": { - "name": "context_presence_id_presence_id_fk", - "tableFrom": "context", - "tableTo": "presence", - "schemaTo": "mesh", - "columnsFrom": [ - "presence_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file": { - "name": "file", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "mime_type": { - "name": "mime_type", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "minio_key": { - "name": "minio_key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "persistent": { - "name": "persistent", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_by_member": { - "name": "uploaded_by_member", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "file_mesh_id_mesh_id_fk": { - "name": "file_mesh_id_mesh_id_fk", - "tableFrom": "file", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "file_uploaded_by_member_member_id_fk": { - "name": "file_uploaded_by_member_member_id_fk", - "tableFrom": "file", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "uploaded_by_member" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.file_access": { - "name": "file_access", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "file_id": { - "name": "file_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "peer_session_pubkey": { - "name": "peer_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_name": { - "name": "peer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "accessed_at": { - "name": "accessed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "file_access_file_id_file_id_fk": { - "name": "file_access_file_id_file_id_fk", - "tableFrom": "file_access", - "tableTo": "file", - "schemaTo": "mesh", - "columnsFrom": [ - "file_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.member": { - "name": "member", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "peer_pubkey": { - "name": "peer_pubkey", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "role", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "joined_at": { - "name": "joined_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "member_mesh_id_mesh_id_fk": { - "name": "member_mesh_id_mesh_id_fk", - "tableFrom": "member", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "member_user_id_user_id_fk": { - "name": "member_user_id_user_id_fk", - "tableFrom": "member", - "tableTo": "user", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.memory": { - "name": "memory", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "remembered_by": { - "name": "remembered_by", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_by_name": { - "name": "remembered_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remembered_at": { - "name": "remembered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "forgotten_at": { - "name": "forgotten_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "memory_mesh_id_mesh_id_fk": { - "name": "memory_mesh_id_mesh_id_fk", - "tableFrom": "memory", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "memory_remembered_by_member_id_fk": { - "name": "memory_remembered_by_member_id_fk", - "tableFrom": "memory", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "remembered_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.state": { - "name": "state", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "updated_by_presence": { - "name": "updated_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_by_name": { - "name": "updated_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "state_mesh_key_idx": { - "name": "state_mesh_key_idx", - "columns": [ - { - "expression": "mesh_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "state_mesh_id_mesh_id_fk": { - "name": "state_mesh_id_mesh_id_fk", - "tableFrom": "state", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.stream": { - "name": "stream", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_by_name": { - "name": "created_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "stream_mesh_name_idx": { - "name": "stream_mesh_name_idx", - "columns": [ - { - "expression": "mesh_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "stream_mesh_id_mesh_id_fk": { - "name": "stream_mesh_id_mesh_id_fk", - "tableFrom": "stream", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.task": { - "name": "task", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "assignee": { - "name": "assignee", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_by_name": { - "name": "claimed_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "claimed_by_presence": { - "name": "claimed_by_presence", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "priority": { - "name": "priority", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'normal'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "'open'" - }, - "tags": { - "name": "tags", - "type": "text[]", - "primaryKey": false, - "notNull": false, - "default": "'{}'" - }, - "result": { - "name": "result", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_by_name": { - "name": "created_by_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "claimed_at": { - "name": "claimed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "task_mesh_id_mesh_id_fk": { - "name": "task_mesh_id_mesh_id_fk", - "tableFrom": "task", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "task_claimed_by_presence_presence_id_fk": { - "name": "task_claimed_by_presence_presence_id_fk", - "tableFrom": "task", - "tableTo": "presence", - "schemaTo": "mesh", - "columnsFrom": [ - "claimed_by_presence" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.message_queue": { - "name": "message_queue", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "mesh_id": { - "name": "mesh_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_member_id": { - "name": "sender_member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "sender_session_pubkey": { - "name": "sender_session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "target_spec": { - "name": "target_spec", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "priority": { - "name": "priority", - "type": "message_priority", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'next'" - }, - "nonce": { - "name": "nonce", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "ciphertext": { - "name": "ciphertext", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "delivered_at": { - "name": "delivered_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "message_queue_mesh_id_mesh_id_fk": { - "name": "message_queue_mesh_id_mesh_id_fk", - "tableFrom": "message_queue", - "tableTo": "mesh", - "schemaTo": "mesh", - "columnsFrom": [ - "mesh_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "message_queue_sender_member_id_member_id_fk": { - "name": "message_queue_sender_member_id_member_id_fk", - "tableFrom": "message_queue", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "sender_member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.pending_status": { - "name": "pending_status", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status_source": { - "name": "status_source", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "applied_at": { - "name": "applied_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "mesh.presence": { - "name": "presence", - "schema": "mesh", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true - }, - "member_id": { - "name": "member_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_id": { - "name": "session_id", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "session_pubkey": { - "name": "session_pubkey", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "display_name": { - "name": "display_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "pid": { - "name": "pid", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "cwd": { - "name": "cwd", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "presence_status", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'idle'" - }, - "status_source": { - "name": "status_source", - "type": "presence_status_source", - "typeSchema": "mesh", - "primaryKey": false, - "notNull": true, - "default": "'jsonl'" - }, - "status_updated_at": { - "name": "status_updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "groups": { - "name": "groups", - "type": "jsonb", - "primaryKey": false, - "notNull": false, - "default": "'[]'::jsonb" - }, - "connected_at": { - "name": "connected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_ping_at": { - "name": "last_ping_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "disconnected_at": { - "name": "disconnected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "presence_member_id_member_id_fk": { - "name": "presence_member_id_member_id_fk", - "tableFrom": "presence", - "tableTo": "member", - "schemaTo": "mesh", - "columnsFrom": [ - "member_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.credit_transaction_type": { - "name": "credit_transaction_type", - "schema": "public", - "values": [ - "signup", - "purchase", - "usage", - "admin_grant", - "admin_deduct", - "refund", - "promo", - "referral", - "expiry" - ] - }, - "public.status": { - "name": "status", - "schema": "public", - "values": [ - "active", - "canceled", - "incomplete", - "incomplete_expired", - "past_due", - "paused", - "trialing", - "unpaid" - ] - }, - "public.plan": { - "name": "plan", - "schema": "public", - "values": [ - "free", - "premium", - "enterprise" - ] - }, - "chat.role": { - "name": "role", - "schema": "chat", - "values": [ - "system", - "assistant", - "user" - ] - }, - "pdf.role": { - "name": "role", - "schema": "pdf", - "values": [ - "user", - "assistant", - "system" - ] - }, - "pdf.processing_status": { - "name": "processing_status", - "schema": "pdf", - "values": [ - "pending", - "processing", - "ready", - "failed" - ] - }, - "pdf.unit_type": { - "name": "unit_type", - "schema": "pdf", - "values": [ - "prose", - "heading", - "list", - "table", - "code" - ] - }, - "image.aspect_ratio": { - "name": "aspect_ratio", - "schema": "image", - "values": [ - "square", - "standard", - "landscape", - "portrait" - ] - }, - "mesh.role": { - "name": "role", - "schema": "mesh", - "values": [ - "admin", - "member" - ] - }, - "mesh.tier": { - "name": "tier", - "schema": "mesh", - "values": [ - "free", - "pro", - "team", - "enterprise" - ] - }, - "mesh.transport": { - "name": "transport", - "schema": "mesh", - "values": [ - "managed", - "tailscale", - "self_hosted" - ] - }, - "mesh.visibility": { - "name": "visibility", - "schema": "mesh", - "values": [ - "private", - "public" - ] - }, - "mesh.message_priority": { - "name": "message_priority", - "schema": "mesh", - "values": [ - "now", - "next", - "low" - ] - }, - "mesh.presence_status": { - "name": "presence_status", - "schema": "mesh", - "values": [ - "idle", - "working", - "dnd" - ] - }, - "mesh.presence_status_source": { - "name": "presence_status_source", - "schema": "mesh", - "values": [ - "hook", - "manual", - "jsonl" - ] - } - }, - "schemas": { - "chat": "chat", - "pdf": "pdf", - "image": "image", - "mesh": "mesh" - }, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json deleted file mode 100644 index c375790..0000000 --- a/packages/db/migrations/meta/_journal.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1775336269295, - "tag": "0000_living_namora", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1775339743477, - "tag": "0001_demonic_karnak", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1775340519054, - "tag": "0002_vengeful_enchantress", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1775463897329, - "tag": "0003_add-presence-summary", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1775468683383, - "tag": "0004_add-presence-display-name", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1775470435032, - "tag": "0005_add-presence-session-pubkey", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1775470979207, - "tag": "0006_add-sender-session-pubkey", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1775476994511, - "tag": "0007_add-presence-groups", - "breakpoints": true - }, - { - "idx": 8, - "version": "7", - "when": 1775477883426, - "tag": "0008_add-state-and-memory", - "breakpoints": true - }, - { - "idx": 9, - "version": "7", - "when": 1775480008546, - "tag": "0009_add-file-tables", - "breakpoints": true - }, - { - "idx": 10, - "version": "7", - "when": 1775480729014, - "tag": "0010_add-context-and-tasks", - "breakpoints": true - }, - { - "idx": 11, - "version": "7", - "when": 1775481222701, - "tag": "0011_add-streams", - "breakpoints": true - } - ] -} \ No newline at end of file