Files
BizGaze_Remote/server/dbx.js
T

11 lines
765 B
JavaScript
Raw Normal View History

// 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';
module.exports = require('./db/' + name);