diff --git a/apps/api/src/routes/logs.ts b/apps/api/src/routes/logs.ts
index fb6791ee73..6459708645 100644
--- a/apps/api/src/routes/logs.ts
+++ b/apps/api/src/routes/logs.ts
@@ -37,6 +37,8 @@ const logSchema = z.object({
topP: z.number().nullable(),
frequencyPenalty: z.number().nullable(),
presencePenalty: z.number().nullable(),
+ tools: z.any().nullable(),
+ toolChoice: z.any().nullable(),
hasError: z.boolean().nullable(),
errorDetails: errorDetails.nullable(),
cost: z.number().nullable(),
diff --git a/apps/gateway/src/chat/chat.ts b/apps/gateway/src/chat/chat.ts
index 3fff4f09c2..8881108df3 100644
--- a/apps/gateway/src/chat/chat.ts
+++ b/apps/gateway/src/chat/chat.ts
@@ -81,6 +81,8 @@ function createLogEntry(
top_p: number | undefined,
frequency_penalty: number | undefined,
presence_penalty: number | undefined,
+ tools: any[] | undefined,
+ toolChoice: any | undefined,
) {
return {
requestId,
@@ -98,6 +100,8 @@ function createLogEntry(
topP: top_p || null,
frequencyPenalty: frequency_penalty || null,
presencePenalty: presence_penalty || null,
+ tools: tools || null,
+ toolChoice: toolChoice || null,
mode: project.mode,
} as const;
}
@@ -339,66 +343,6 @@ function extractReasoningContentFromProvider(
}
}
-/**
- * Extracts tool calls from streaming data based on provider format
- */
-function extractToolCallsFromProvider(
- data: any,
- provider: Provider,
-): Array<{
- id: string;
- type: string;
- function: {
- name: string;
- arguments: string;
- };
-}> | null {
- switch (provider) {
- case "anthropic":
- // For Anthropic, tool calls come in content_block_start and content_block_delta events
- if (
- data.type === "content_block_start" &&
- data.content_block?.type === "tool_use"
- ) {
- return [
- {
- id: data.content_block.id,
- type: "function",
- function: {
- name: data.content_block.name,
- arguments: "",
- },
- },
- ];
- } else if (
- data.type === "content_block_delta" &&
- data.delta?.partial_json
- ) {
- // Return partial arguments for accumulation
- return [
- {
- id: "", // Will be matched by index
- type: "function",
- function: {
- name: "",
- arguments: data.delta.partial_json,
- },
- },
- ];
- }
- return null;
- case "inference.net":
- case "together.ai":
- case "groq":
- case "deepseek":
- case "perplexity":
- case "alibaba":
- return data.choices?.[0]?.delta?.tool_calls || null;
- default: // OpenAI format
- return data.choices?.[0]?.delta?.tool_calls || null;
- }
-}
-
/**
* Extracts token usage information from streaming data based on provider format
*/
@@ -1666,14 +1610,6 @@ chat.openapi(completions, async (c) => {
let totalTokens = null;
let reasoningTokens = null;
let cachedTokens = null;
- let fullToolCalls: Array<{
- id: string;
- type: string;
- function: {
- name: string;
- arguments: string;
- };
- }> = [];
for (const chunk of cachedStreamingResponse.chunks) {
try {
@@ -1690,42 +1626,6 @@ chat.openapi(completions, async (c) => {
chunkData.choices[0].delta.reasoning_content;
}
- // Accumulate tool calls from streaming chunks
- if (chunkData.choices?.[0]?.delta?.tool_calls) {
- const deltaToolCalls = chunkData.choices[0].delta.tool_calls;
- for (const deltaToolCall of deltaToolCalls) {
- const index = deltaToolCall.index || 0;
-
- // Ensure we have a tool call at this index
- while (fullToolCalls.length <= index) {
- fullToolCalls.push({
- id: "",
- type: "function",
- function: {
- name: "",
- arguments: "",
- },
- });
- }
-
- // Accumulate the tool call data
- if (deltaToolCall.id) {
- fullToolCalls[index].id = deltaToolCall.id;
- }
- if (deltaToolCall.type) {
- fullToolCalls[index].type = deltaToolCall.type;
- }
- if (deltaToolCall.function?.name) {
- fullToolCalls[index].function.name =
- deltaToolCall.function.name;
- }
- if (deltaToolCall.function?.arguments) {
- fullToolCalls[index].function.arguments +=
- deltaToolCall.function.arguments;
- }
- }
- }
-
// Extract usage information (usually in the last chunks)
if (chunkData.usage) {
if (chunkData.usage.prompt_tokens) {
@@ -1767,6 +1667,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -1775,7 +1677,6 @@ chat.openapi(completions, async (c) => {
responseSize: JSON.stringify(cachedStreamingResponse).length,
content: fullContent || null,
reasoningContent: fullReasoningContent || null,
- toolCalls: fullToolCalls.length > 0 ? fullToolCalls : null,
finishReason: cachedStreamingResponse.metadata.finishReason,
promptTokens: promptTokens?.toString() || null,
completionTokens: completionTokens?.toString() || null,
@@ -1842,6 +1743,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -2005,6 +1908,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -2088,6 +1993,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -2148,14 +2055,6 @@ chat.openapi(completions, async (c) => {
let totalTokens = null;
let reasoningTokens = null;
let cachedTokens = null;
- let fullToolCalls: Array<{
- id: string;
- type: string;
- function: {
- name: string;
- arguments: string;
- };
- }> | null = null;
let buffer = ""; // Buffer for accumulating partial data across chunks
const MAX_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB limit
@@ -2249,31 +2148,6 @@ chat.openapi(completions, async (c) => {
fullReasoningContent += reasoningContentChunk;
}
- // Extract tool calls for logging using helper function
- const toolCallsChunk = extractToolCallsFromProvider(
- data,
- usedProvider,
- );
- if (toolCallsChunk) {
- if (!fullToolCalls) {
- fullToolCalls = [];
- }
- // For Google providers, accumulate tool calls
- for (const toolCall of toolCallsChunk) {
- const existingIndex = fullToolCalls.findIndex(
- (tc) => tc.id === toolCall.id,
- );
- if (existingIndex >= 0) {
- // Update existing tool call
- fullToolCalls[existingIndex].function.arguments +=
- toolCall.function.arguments;
- } else {
- // Add new tool call
- fullToolCalls.push(toolCall);
- }
- }
- }
-
// Check for finish reason
if (data.candidates && data.candidates[0]?.finishReason) {
finishReason = data.candidates[0].finishReason;
@@ -2464,67 +2338,6 @@ chat.openapi(completions, async (c) => {
fullReasoningContent += reasoningContentChunk;
}
- // Extract tool calls using helper function
- const toolCallsChunk = extractToolCallsFromProvider(
- data,
- usedProvider,
- );
- if (toolCallsChunk) {
- if (!fullToolCalls) {
- fullToolCalls = [];
- }
-
- if (usedProvider === "anthropic") {
- // For Anthropic, handle content_block_start and content_block_delta
- for (const toolCall of toolCallsChunk) {
- if (data.type === "content_block_start") {
- // New tool call
- fullToolCalls.push(toolCall);
- } else if (data.type === "content_block_delta") {
- // Accumulate arguments for the last tool call
- const lastIndex = fullToolCalls.length - 1;
- if (lastIndex >= 0) {
- fullToolCalls[lastIndex].function.arguments +=
- toolCall.function.arguments;
- }
- }
- }
- } else {
- // For OpenAI format providers - these have index and delta format
- for (const deltaToolCall of toolCallsChunk as any[]) {
- const index = deltaToolCall.index || 0;
-
- // Ensure we have a tool call at this index
- while (fullToolCalls.length <= index) {
- fullToolCalls.push({
- id: "",
- type: "function",
- function: {
- name: "",
- arguments: "",
- },
- });
- }
-
- // Accumulate the tool call data
- if (deltaToolCall.id) {
- fullToolCalls[index].id = deltaToolCall.id;
- }
- if (deltaToolCall.type) {
- fullToolCalls[index].type = deltaToolCall.type;
- }
- if (deltaToolCall.function?.name) {
- fullToolCalls[index].function.name =
- deltaToolCall.function.name;
- }
- if (deltaToolCall.function?.arguments) {
- fullToolCalls[index].function.arguments +=
- deltaToolCall.function.arguments;
- }
- }
- }
- }
-
// Handle provider-specific finish reason extraction
switch (usedProvider) {
case "anthropic":
@@ -2754,6 +2567,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -2762,7 +2577,6 @@ chat.openapi(completions, async (c) => {
responseSize: fullContent.length,
content: fullContent,
reasoningContent: fullReasoningContent || null,
- toolCalls: fullToolCalls,
finishReason: finishReason,
promptTokens: calculatedPromptTokens?.toString() || null,
completionTokens: calculatedCompletionTokens?.toString() || null,
@@ -2780,6 +2594,8 @@ chat.openapi(completions, async (c) => {
cost: costs.totalCost,
estimatedCost: costs.estimatedCost,
cached: false,
+ tools,
+ toolChoice: tool_choice,
});
// Save streaming cache if enabled and not canceled
@@ -2863,6 +2679,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -2924,6 +2742,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -3030,6 +2850,8 @@ chat.openapi(completions, async (c) => {
top_p,
frequency_penalty,
presence_penalty,
+ tools,
+ tool_choice,
);
await insertLog({
@@ -3038,7 +2860,6 @@ chat.openapi(completions, async (c) => {
responseSize: responseText.length,
content: content,
reasoningContent: reasoningContent,
- toolCalls: toolCalls,
finishReason: finishReason,
promptTokens: calculatedPromptTokens?.toString() || null,
completionTokens: calculatedCompletionTokens?.toString() || null,
@@ -3060,6 +2881,8 @@ chat.openapi(completions, async (c) => {
cost: costs.totalCost,
estimatedCost: costs.estimatedCost,
cached: false,
+ tools,
+ toolChoice: tool_choice,
});
// Transform response to OpenAI format for non-OpenAI providers
diff --git a/apps/next/src/components/activity/recent-logs.tsx b/apps/next/src/components/activity/recent-logs.tsx
index a6c3086c16..91104ce769 100644
--- a/apps/next/src/components/activity/recent-logs.tsx
+++ b/apps/next/src/components/activity/recent-logs.tsx
@@ -59,6 +59,8 @@ interface RecentLogsProps {
topP: number | null;
frequencyPenalty: number | null;
presencePenalty: number | null;
+ tools: string | null;
+ toolChoice: string | null;
hasError: boolean | null;
errorDetails: {
statusCode: number;
@@ -290,7 +292,8 @@ export function RecentLogs({ initialData }: RecentLogsProps) {
createdAt: new Date(log.createdAt),
updatedAt: new Date(log.updatedAt),
messages: log.messages as any,
- toolCalls: null,
+ tools: log.tools,
+ toolChoice: log.toolChoice,
errorDetails: log.errorDetails as any,
cachedTokens: (log as any).cachedTokens || null,
cachedInputCost: (log as any).cachedInputCost || null,
diff --git a/apps/next/src/components/dashboard/log-card.tsx b/apps/next/src/components/dashboard/log-card.tsx
index 16b304b2ab..ed51f55537 100644
--- a/apps/next/src/components/dashboard/log-card.tsx
+++ b/apps/next/src/components/dashboard/log-card.tsx
@@ -312,6 +312,37 @@ export function LogCard({ log }: { log: Log }) {
+ {((log as any).tools || (log as any).toolChoice) && (
+
+
Tool Information
+
+ {(log as any).tools && (
+
+
+ Available Tools
+
+
+
+ {JSON.stringify((log as any).tools, null, 2)}
+
+
+
+ )}
+ {(log as any).toolChoice && (
+
+
+ Tool Choice
+
+
+
+ {JSON.stringify((log as any).toolChoice, null, 2)}
+
+
+
+ )}
+
+
+ )}
{log.hasError && !!log.errorDetails && (
@@ -355,6 +386,7 @@ export function LogCard({ log }: { log: Log }) {
)}
+ `
)}
diff --git a/apps/next/src/lib/api/v1.d.ts b/apps/next/src/lib/api/v1.d.ts
index 93a9ea75b7..754cb99da1 100644
--- a/apps/next/src/lib/api/v1.d.ts
+++ b/apps/next/src/lib/api/v1.d.ts
@@ -522,6 +522,8 @@ export interface paths {
topP: number | null;
frequencyPenalty: number | null;
presencePenalty: number | null;
+ tools?: unknown;
+ toolChoice?: unknown;
hasError: boolean | null;
errorDetails: {
statusCode: number;
diff --git a/apps/next/src/types/activity.ts b/apps/next/src/types/activity.ts
index 2500b988c7..3df73d9e10 100644
--- a/apps/next/src/types/activity.ts
+++ b/apps/next/src/types/activity.ts
@@ -88,6 +88,8 @@ export interface LogsData {
topP: number | null;
frequencyPenalty: number | null;
presencePenalty: number | null;
+ tools: string | null;
+ toolChoice: string | null;
hasError: boolean | null;
errorDetails: {
statusCode: number;
diff --git a/apps/ui/src/components/activity/recent-logs.tsx b/apps/ui/src/components/activity/recent-logs.tsx
index 79ef73bcd5..b6f58ad117 100644
--- a/apps/ui/src/components/activity/recent-logs.tsx
+++ b/apps/ui/src/components/activity/recent-logs.tsx
@@ -157,7 +157,8 @@ export function RecentLogs() {
createdAt: new Date(log.createdAt),
updatedAt: new Date(log.updatedAt),
messages: log.messages as any,
- toolCalls: null,
+ tools: (log as any).tools,
+ toolChoice: (log as any).toolChoice,
errorDetails: log.errorDetails as any,
reasoningTokens: log.reasoningTokens,
reasoningContent: (log as any).reasoningContent,
diff --git a/apps/ui/src/components/dashboard/log-card.tsx b/apps/ui/src/components/dashboard/log-card.tsx
index 417c0127f7..5032bf1a73 100644
--- a/apps/ui/src/components/dashboard/log-card.tsx
+++ b/apps/ui/src/components/dashboard/log-card.tsx
@@ -312,6 +312,51 @@ export function LogCard({ log }: { log: Log }) {
+ {((log as any).tools ||
+ (log as any).toolChoice ||
+ (log as any).toolCalls) && (
+
+
Tool Information
+
+ {(log as any).tools && (
+
+
+ Available Tools
+
+
+
+ {JSON.stringify((log as any).tools, null, 2)}
+
+
+
+ )}
+ {(log as any).toolChoice && (
+
+
+ Tool Choice
+
+
+
+ {JSON.stringify((log as any).toolChoice, null, 2)}
+
+
+
+ )}
+ {(log as any).toolCalls && (
+
+
+ Tool Calls
+
+
+
+ {JSON.stringify((log as any).toolCalls, null, 2)}
+
+
+
+ )}
+
+
+ )}
{log.hasError && !!log.errorDetails && (
diff --git a/apps/ui/src/lib/api/v1.d.ts b/apps/ui/src/lib/api/v1.d.ts
index 93a9ea75b7..754cb99da1 100644
--- a/apps/ui/src/lib/api/v1.d.ts
+++ b/apps/ui/src/lib/api/v1.d.ts
@@ -522,6 +522,8 @@ export interface paths {
topP: number | null;
frequencyPenalty: number | null;
presencePenalty: number | null;
+ tools?: unknown;
+ toolChoice?: unknown;
hasError: boolean | null;
errorDetails: {
statusCode: number;
diff --git a/packages/db/migrations/1753466042_motionless_cardiac.sql b/packages/db/migrations/1753466042_motionless_cardiac.sql
new file mode 100644
index 0000000000..67ac8a3cc7
--- /dev/null
+++ b/packages/db/migrations/1753466042_motionless_cardiac.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "log" ADD COLUMN "tools" json;--> statement-breakpoint
+ALTER TABLE "log" ADD COLUMN "tool_choice" json;
\ No newline at end of file
diff --git a/packages/db/migrations/1753485632_dusty_tarot.sql b/packages/db/migrations/1753485632_dusty_tarot.sql
new file mode 100644
index 0000000000..1dfd63a278
--- /dev/null
+++ b/packages/db/migrations/1753485632_dusty_tarot.sql
@@ -0,0 +1 @@
+ALTER TABLE "log" DROP COLUMN "tool_calls";
\ No newline at end of file
diff --git a/packages/db/migrations/meta/1753466042_snapshot.json b/packages/db/migrations/meta/1753466042_snapshot.json
new file mode 100644
index 0000000000..36d49405bf
--- /dev/null
+++ b/packages/db/migrations/meta/1753466042_snapshot.json
@@ -0,0 +1,1722 @@
+{
+ "id": "9a9e28e6-0e25-4fc7-a988-4092bea2408b",
+ "prevId": "8c86add2-bf12-4f10-bef2-0576ad104d03",
+ "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,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "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.api_key": {
+ "name": "api_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "api_key_project_id_project_id_fk": {
+ "name": "api_key_project_id_project_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "api_key_token_unique": {
+ "name": "api_key_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat": {
+ "name": "chat",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.installation": {
+ "name": "installation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "uuid": {
+ "name": "uuid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "installation_uuid_unique": {
+ "name": "installation_uuid_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "uuid"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.lock": {
+ "name": "lock",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "lock_key_unique": {
+ "name": "lock_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.log": {
+ "name": "log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "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,
+ "default": "now()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "api_key_id": {
+ "name": "api_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_model": {
+ "name": "requested_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_provider": {
+ "name": "requested_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "used_model": {
+ "name": "used_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_provider": {
+ "name": "used_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_size": {
+ "name": "response_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_content": {
+ "name": "reasoning_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_calls": {
+ "name": "tool_calls",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_choice": {
+ "name": "tool_choice",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finish_reason": {
+ "name": "finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unified_finish_reason": {
+ "name": "unified_finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt_tokens": {
+ "name": "prompt_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion_tokens": {
+ "name": "completion_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_tokens": {
+ "name": "reasoning_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cached_tokens": {
+ "name": "cached_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "messages": {
+ "name": "messages",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_tokens": {
+ "name": "max_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "top_p": {
+ "name": "top_p",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "frequency_penalty": {
+ "name": "frequency_penalty",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "presence_penalty": {
+ "name": "presence_penalty",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_error": {
+ "name": "has_error",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "error_details": {
+ "name": "error_details",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost": {
+ "name": "cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_cost": {
+ "name": "input_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_cost": {
+ "name": "output_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cached_input_cost": {
+ "name": "cached_input_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_cost": {
+ "name": "request_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimated_cost": {
+ "name": "estimated_cost",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "canceled": {
+ "name": "canceled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "streamed": {
+ "name": "streamed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "cached": {
+ "name": "cached",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_mode": {
+ "name": "used_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "log_organization_id_organization_id_fk": {
+ "name": "log_organization_id_organization_id_fk",
+ "tableFrom": "log",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "log_project_id_project_id_fk": {
+ "name": "log_project_id_project_id_fk",
+ "tableFrom": "log",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "log_api_key_id_api_key_id_fk": {
+ "name": "log_api_key_id_api_key_id_fk",
+ "tableFrom": "log",
+ "tableTo": "api_key",
+ "columnsFrom": [
+ "api_key_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.message": {
+ "name": "message",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "message_chat_id_chat_id_fk": {
+ "name": "message_chat_id_chat_id_fk",
+ "tableFrom": "message",
+ "tableTo": "chat",
+ "columnsFrom": [
+ "chat_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
+ },
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credits": {
+ "name": "credits",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "auto_top_up_enabled": {
+ "name": "auto_top_up_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "auto_top_up_threshold": {
+ "name": "auto_top_up_threshold",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'10'"
+ },
+ "auto_top_up_amount": {
+ "name": "auto_top_up_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'10'"
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'free'"
+ },
+ "plan_expires_at": {
+ "name": "plan_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subscription_cancelled": {
+ "name": "subscription_cancelled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trial_start_date": {
+ "name": "trial_start_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_end_date": {
+ "name": "trial_end_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_trial_active": {
+ "name": "is_trial_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "retention_level": {
+ "name": "retention_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'retain'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_stripeCustomerId_unique": {
+ "name": "organization_stripeCustomerId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_customer_id"
+ ]
+ },
+ "organization_stripeSubscriptionId_unique": {
+ "name": "organization_stripeSubscriptionId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_subscription_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_action": {
+ "name": "organization_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_action_organization_id_organization_id_fk": {
+ "name": "organization_action_organization_id_organization_id_fk",
+ "tableFrom": "organization_action",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "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": false
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "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.payment_method": {
+ "name": "payment_method",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "stripe_payment_method_id": {
+ "name": "stripe_payment_method_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "payment_method_organization_id_organization_id_fk": {
+ "name": "payment_method_organization_id_organization_id_fk",
+ "tableFrom": "payment_method",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caching_enabled": {
+ "name": "caching_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cache_duration_seconds": {
+ "name": "cache_duration_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 60
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'credits'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_organization_id_organization_id_fk": {
+ "name": "project_organization_id_organization_id_fk",
+ "tableFrom": "project",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.provider_key": {
+ "name": "provider_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_url": {
+ "name": "base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "provider_key_organization_id_organization_id_fk": {
+ "name": "provider_key_organization_id_organization_id_fk",
+ "tableFrom": "provider_key",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "provider_key_organizationId_name_unique": {
+ "name": "provider_key_organizationId_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "name"
+ ]
+ }
+ },
+ "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,
+ "default": "now()"
+ },
+ "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,
+ "default": "now()"
+ },
+ "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
+ }
+ },
+ "indexes": {},
+ "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.transaction": {
+ "name": "transaction",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_amount": {
+ "name": "credit_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'USD'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'completed'"
+ },
+ "stripe_payment_intent_id": {
+ "name": "stripe_payment_intent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "transaction_organization_id_organization_id_fk": {
+ "name": "transaction_organization_id_organization_id_fk",
+ "tableFrom": "transaction",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_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
+ },
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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
+ },
+ "onboarding_completed": {
+ "name": "onboarding_completed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_organization": {
+ "name": "user_organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_organization_user_id_user_id_fk": {
+ "name": "user_organization_user_id_user_id_fk",
+ "tableFrom": "user_organization",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_organization_organization_id_organization_id_fk": {
+ "name": "user_organization_organization_id_organization_id_fk",
+ "tableFrom": "user_organization",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/migrations/meta/1753485632_snapshot.json b/packages/db/migrations/meta/1753485632_snapshot.json
new file mode 100644
index 0000000000..0af1fa2b48
--- /dev/null
+++ b/packages/db/migrations/meta/1753485632_snapshot.json
@@ -0,0 +1,1716 @@
+{
+ "id": "6ab8b018-6821-49c6-9e4d-927fea1f617d",
+ "prevId": "9a9e28e6-0e25-4fc7-a988-4092bea2408b",
+ "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,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "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.api_key": {
+ "name": "api_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "api_key_project_id_project_id_fk": {
+ "name": "api_key_project_id_project_id_fk",
+ "tableFrom": "api_key",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "api_key_token_unique": {
+ "name": "api_key_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat": {
+ "name": "chat",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.installation": {
+ "name": "installation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "uuid": {
+ "name": "uuid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "installation_uuid_unique": {
+ "name": "installation_uuid_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "uuid"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.lock": {
+ "name": "lock",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "lock_key_unique": {
+ "name": "lock_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.log": {
+ "name": "log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "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,
+ "default": "now()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "api_key_id": {
+ "name": "api_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_model": {
+ "name": "requested_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_provider": {
+ "name": "requested_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "used_model": {
+ "name": "used_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_provider": {
+ "name": "used_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_size": {
+ "name": "response_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_content": {
+ "name": "reasoning_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_choice": {
+ "name": "tool_choice",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finish_reason": {
+ "name": "finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unified_finish_reason": {
+ "name": "unified_finish_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt_tokens": {
+ "name": "prompt_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion_tokens": {
+ "name": "completion_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_tokens": {
+ "name": "total_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_tokens": {
+ "name": "reasoning_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cached_tokens": {
+ "name": "cached_tokens",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "messages": {
+ "name": "messages",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_tokens": {
+ "name": "max_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "top_p": {
+ "name": "top_p",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "frequency_penalty": {
+ "name": "frequency_penalty",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "presence_penalty": {
+ "name": "presence_penalty",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_error": {
+ "name": "has_error",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "error_details": {
+ "name": "error_details",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost": {
+ "name": "cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_cost": {
+ "name": "input_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_cost": {
+ "name": "output_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cached_input_cost": {
+ "name": "cached_input_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_cost": {
+ "name": "request_cost",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimated_cost": {
+ "name": "estimated_cost",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "canceled": {
+ "name": "canceled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "streamed": {
+ "name": "streamed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "cached": {
+ "name": "cached",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_mode": {
+ "name": "used_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "log_organization_id_organization_id_fk": {
+ "name": "log_organization_id_organization_id_fk",
+ "tableFrom": "log",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "log_project_id_project_id_fk": {
+ "name": "log_project_id_project_id_fk",
+ "tableFrom": "log",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "log_api_key_id_api_key_id_fk": {
+ "name": "log_api_key_id_api_key_id_fk",
+ "tableFrom": "log",
+ "tableTo": "api_key",
+ "columnsFrom": [
+ "api_key_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.message": {
+ "name": "message",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "message_chat_id_chat_id_fk": {
+ "name": "message_chat_id_chat_id_fk",
+ "tableFrom": "message",
+ "tableTo": "chat",
+ "columnsFrom": [
+ "chat_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
+ },
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credits": {
+ "name": "credits",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "auto_top_up_enabled": {
+ "name": "auto_top_up_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "auto_top_up_threshold": {
+ "name": "auto_top_up_threshold",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'10'"
+ },
+ "auto_top_up_amount": {
+ "name": "auto_top_up_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'10'"
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'free'"
+ },
+ "plan_expires_at": {
+ "name": "plan_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subscription_cancelled": {
+ "name": "subscription_cancelled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trial_start_date": {
+ "name": "trial_start_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_end_date": {
+ "name": "trial_end_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_trial_active": {
+ "name": "is_trial_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "retention_level": {
+ "name": "retention_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'retain'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_stripeCustomerId_unique": {
+ "name": "organization_stripeCustomerId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_customer_id"
+ ]
+ },
+ "organization_stripeSubscriptionId_unique": {
+ "name": "organization_stripeSubscriptionId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_subscription_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_action": {
+ "name": "organization_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_action_organization_id_organization_id_fk": {
+ "name": "organization_action_organization_id_organization_id_fk",
+ "tableFrom": "organization_action",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "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": false
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "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.payment_method": {
+ "name": "payment_method",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "stripe_payment_method_id": {
+ "name": "stripe_payment_method_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "payment_method_organization_id_organization_id_fk": {
+ "name": "payment_method_organization_id_organization_id_fk",
+ "tableFrom": "payment_method",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caching_enabled": {
+ "name": "caching_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cache_duration_seconds": {
+ "name": "cache_duration_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 60
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'credits'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_organization_id_organization_id_fk": {
+ "name": "project_organization_id_organization_id_fk",
+ "tableFrom": "project",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.provider_key": {
+ "name": "provider_key",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_url": {
+ "name": "base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'active'"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "provider_key_organization_id_organization_id_fk": {
+ "name": "provider_key_organization_id_organization_id_fk",
+ "tableFrom": "provider_key",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "provider_key_organizationId_name_unique": {
+ "name": "provider_key_organizationId_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "name"
+ ]
+ }
+ },
+ "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,
+ "default": "now()"
+ },
+ "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,
+ "default": "now()"
+ },
+ "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
+ }
+ },
+ "indexes": {},
+ "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.transaction": {
+ "name": "transaction",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_amount": {
+ "name": "credit_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'USD'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'completed'"
+ },
+ "stripe_payment_intent_id": {
+ "name": "stripe_payment_intent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "transaction_organization_id_organization_id_fk": {
+ "name": "transaction_organization_id_organization_id_fk",
+ "tableFrom": "transaction",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_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
+ },
+ "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()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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
+ },
+ "onboarding_completed": {
+ "name": "onboarding_completed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_organization": {
+ "name": "user_organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "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()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_organization_user_id_user_id_fk": {
+ "name": "user_organization_user_id_user_id_fk",
+ "tableFrom": "user_organization",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_organization_organization_id_organization_id_fk": {
+ "name": "user_organization_organization_id_organization_id_fk",
+ "tableFrom": "user_organization",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "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
index d088ae8fe7..11cb28de7a 100644
--- a/packages/db/migrations/meta/_journal.json
+++ b/packages/db/migrations/meta/_journal.json
@@ -211,6 +211,20 @@
"when": 1753404831184,
"tag": "1753404831_freezing_sentinel",
"breakpoints": true
+ },
+ {
+ "idx": 30,
+ "version": "7",
+ "when": 1753466042913,
+ "tag": "1753466042_motionless_cardiac",
+ "breakpoints": true
+ },
+ {
+ "idx": 31,
+ "version": "7",
+ "when": 1753485632734,
+ "tag": "1753485632_dusty_tarot",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index 4c66ef8d41..723ceb19cd 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -262,7 +262,8 @@ export const log = pgTable("log", {
responseSize: integer().notNull(),
content: text(),
reasoningContent: text(),
- toolCalls: json(),
+ tools: json(),
+ toolChoice: json(),
finishReason: text(),
unifiedFinishReason: text(),
promptTokens: decimal(),