2026-08-12 08:20:26 +05:30
|
|
|
// Async DB adapter facade. Production runs PostgreSQL. SQLite was RETIRED on 2026-08-12 so there is exactly
|
|
|
|
|
// ONE schema source of truth (db/schema.pg.sql) — no more dual-maintenance drift between a SQLite migration
|
|
|
|
|
// list and the PG schema (that gap once made a column land on SQLite only and 500'd every read on prod).
|
|
|
|
|
//
|
|
|
|
|
// DB_BACKEND is kept for future swappable backends but defaults to 'pg', and only 'pg' ships today. An
|
|
|
|
|
// unknown value fails LOUDLY here at require time (module-not-found) rather than silently selecting a stale
|
|
|
|
|
// or non-existent engine. Every backend implements the same async interface: prepare(sql).{get,all,run},
|
|
|
|
|
// exec(sql), tx(fn), init().
|
|
|
|
|
const name = process.env.DB_BACKEND || 'pg';
|
2026-07-24 21:10:53 +05:30
|
|
|
module.exports = require('./db/' + name);
|