Files

7 lines
511 B
JavaScript
Raw Permalink Normal View History

// Async DB adapter facade. The backend is chosen by DB_BACKEND (default 'sqlite'); 'pg' is added at
// cutover. Every backend implements the same async interface — prepare(sql).{get,all,run}, exec(sql),
// tx(fn), init() — so repos and app code are engine-agnostic. Swapping engines is one backend file, no
// repo changes. (This is the same "never hardwire the engine" principle we'll apply to the pub/sub layer.)
const name = process.env.DB_BACKEND || 'sqlite';
module.exports = require('./db/' + name);