Files
fluxent-web/lib/db/index.ts
T
SerinaNya c33857ffac feat(ledger): add bookkeeping workbench and transaction views
- Add transactions_dirty table and zero-tolerance cleansing action

- Implement bookkeeping workbench (/bookkeeping) with searchable Combobox channel selector and card suffix / account identifier

- Implement transaction ledger (/transactions) with date groupings, multi-currency metrics, and filters

- Update AGENTS.md guidelines for Base UI Select and Combobox bindings
2026-09-06 23:23:29 +08:00

18 lines
573 B
TypeScript

import { drizzle } from "drizzle-orm/postgres-js"
import postgres from "postgres"
import * as schema from "./schema"
const connectionString =
process.env.DATABASE_URL ||
"postgresql://postgres:Aa110011@localhost:5432/fluxent"
// 在 Next.js 开发环境下避免热重载创建重复连接池
const globalForDb = globalThis as unknown as {
conn: postgres.Sql | undefined
}
const client = globalForDb.conn ?? postgres(connectionString, { max: 10 })
if (process.env.NODE_ENV !== "production") globalForDb.conn = client
export const db = drizzle(client, { schema })