import { sql } from 'drizzle-orm'; import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core'; import { Block } from '../types'; export const messages = sqliteTable('messages', { id: integer('id').primaryKey(), messageId: text('messageId').notNull(), chatId: text('chatId').notNull(), backendId: text('backendId').notNull(), query: text('query').notNull(), createdAt: text('createdAt').notNull(), responseBlocks: text('responseBlocks', { mode: 'json' }) .$type() .default(sql`'[]'`), status: text({ enum: ['answering', 'completed', 'error'] }).default( 'answering', ), }); interface DBFile { name: string; fileId: string; } export const chats = sqliteTable('chats', { id: text('id').primaryKey(), title: text('title').notNull(), createdAt: text('createdAt').notNull(), focusMode: text('focusMode').notNull(), files: text('files', { mode: 'json' }) .$type() .default(sql`'[]'`), });