refactor(db): switch records layer to Prisma

- Replace hand-written node:sqlite queries with a Prisma client using
  the better-sqlite3 driver adapter
- Version the schema with migrations: baseline table, timestamp
  normalisation, and WAL journal mode
- Store timestamps with an explicit UTC offset so they stop being parsed
  as local time
- Show created/updated times on the edit page, formatted with dayjs
- Move the root redirect into next.config to avoid a prerender error
- Run migrations from the container entrypoint before starting the server

BREAKING CHANGE: DNSMASQ_ADMIN_DB_PATH is replaced by DATABASE_URL, which
must be a Prisma connection URL (file:./data/dnsmasq-admin.db). Existing
database files are migrated in place and need no conversion.
This commit is contained in:
jamo.siu@gmail.com committed 2026-10-12 14:27:03 +08:00
1 parent 97ad09ad8a
commit 1e4f028685
25 files changed
+1796 -141

No files matched your search

+4 -1
View File
@@ -17,7 +17,10 @@ services:
ports:
- "3000:3000"
environment:
DNSMASQ_ADMIN_DB_PATH: /data/dnsmasq-admin.db
# Must be an absolute path inside the container now: Prisma resolves relative sqlite
# paths against the working directory, and the Prisma CLI does not inherit Next's
# path handling.
DATABASE_URL: file:/data/dnsmasq-admin.db
# Same mounted config directory dnsmasq reads from.
DNSMASQ_ADMIN_CONF_PATH: /etc/dnsmasq.d/dnsmasq-admin.conf
DNSMASQ_CONTAINER_NAME: dnsmasq