yiekheng fa4970a76c feat(db): add drizzle schema for all tables + initial migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 15:19:36 +08:00

14 lines
421 B
TypeScript

import { drizzle, type NodePgDatabase } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import * as schema from "./schema.js";
export * from "./schema.js";
export type DB = NodePgDatabase<typeof schema>;
export function createClient(databaseUrl: string): { db: DB; pool: Pool } {
const pool = new Pool({ connectionString: databaseUrl });
const db = drizzle(pool, { schema });
return { db, pool };
}