- Create Drizzle schema with items, categories, and settings tables - Set up database connection singleton with WAL mode and foreign keys - Add seed script for default Uncategorized category - Create shared Zod validation schemas for items and categories - Export TypeScript types inferred from Zod and Drizzle schemas - Add in-memory SQLite test helper for isolated test databases - Wire seed into Hono server startup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
10 lines
301 B
TypeScript
10 lines
301 B
TypeScript
import { Database } from "bun:sqlite";
|
|
import { drizzle } from "drizzle-orm/bun-sqlite";
|
|
import * as schema from "./schema.ts";
|
|
|
|
const sqlite = new Database("gearbox.db");
|
|
sqlite.run("PRAGMA journal_mode = WAL");
|
|
sqlite.run("PRAGMA foreign_keys = ON");
|
|
|
|
export const db = drizzle(sqlite, { schema });
|