feat(db): drizzle schema (settings, sessions) + boot migrations

This commit is contained in:
marcuspaico
2026-08-17 14:04:56 -07:00
parent caa9af2f40
commit 0f96d5e3b8
7 changed files with 148 additions and 0 deletions

16
server/test/db.test.ts Normal file
View File

@@ -0,0 +1,16 @@
import { describe, expect, test } from "bun:test";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { openDb } from "../src/db";
import { settings } from "../src/db/schema";
describe("db", () => {
test("opens, migrates, round-trips a setting", async () => {
const dir = mkdtempSync(join(tmpdir(), "helios-"));
const db = openDb(dir);
await db.insert(settings).values({ key: "llm_base_url", value: "https://openrouter.ai/api/v1" });
const rows = await db.select().from(settings);
expect(rows).toEqual([{ key: "llm_base_url", value: "https://openrouter.ai/api/v1" }]);
});
});