Retire the SQLite backend — Postgres is the only engine

The dual backend (SQLite via db.js + Postgres via schema.pg.sql) was a
maintenance foot-gun: a schema change could land on the SQLite path only and
silently 500 every read on prod (it just did, with #18/#13). Production has run
on Postgres for weeks, so SQLite is retired: ONE schema source of truth
(db/schema.pg.sql), no drift possible.

- dbx.js: default DB_BACKEND=pg; an unknown backend now fails loudly at require
  time instead of silently selecting a stale engine.
- Deleted server/db.js, server/db/sqlite.js, server/db/migrate-sqlite-to-pg.js,
  server/scripts/migrate-bizgaze-only.js (all SQLite-only, none in the runtime
  path — the running server loads db/pg.js).
- Tests (e2e, db-smoke) target Postgres now and fail-fast (skip) unless
  DATABASE_URL points at a disposable test DB — never SQLite, never prod.
- Removed the dead DB_PATH env + fixed misleading SQLite comments in the
  Dockerfile / docker-compose (kept the /data volume: it holds
  uploads/recordings/transcripts/downloads, not just the old data.db).
- CLAUDE.md: stack + repo-layout + run-locally updated for Postgres-only.

Runtime is unaffected (prod already sets DB_BACKEND=pg and pg is a prod dep);
this only removes the unused SQLite path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 08:20:26 +05:30
parent f3b6e67c19
commit ad48829337
11 changed files with 52 additions and 622 deletions
+4 -5
View File
@@ -10,7 +10,6 @@ services:
restart: unless-stopped
environment:
- PORT=8090
- DB_PATH=/data/data.db
# Desktop installers + auto-update feed live on the persistent volume so uploaded
# builds survive image rebuilds (a plain image path would be wiped on every deploy).
- DOWNLOADS_DIR=/data/downloads
@@ -31,16 +30,16 @@ services:
- path: .env
required: false
volumes:
- bizgaze_support_data:/data # persists data.db across rebuilds
- bizgaze_support_data:/data # persists uploads / recordings / transcripts / downloads across rebuilds
networks:
- npm
# Wait for Postgres to be healthy before starting. Only matters when DB_BACKEND=pg (else the app uses
# the local SQLite file and ignores pg), but it's harmless on SQLite — pg comes up in a second or two.
# The DB is Postgres (SQLite retired 2026-08-12), so wait for it to be healthy before the app starts —
# otherwise the first queries race the DB coming up.
depends_on:
bizgazepg:
condition: service_healthy
# PostgreSQL — the app's data store when DB_BACKEND=pg (default is the local SQLite file). Distinct
# PostgreSQL — the app's data store (DB_BACKEND=pg; the only backend since SQLite was retired). Distinct
# service/container name so it never collides with the other postgres containers on the shared NPM
# network; the app reaches it as `bizgaze-postgres`. Data on its own named volume.
bizgazepg: