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:
25 files changed
+1796
-141
No files matched your search
+12
-4
@@ -1,8 +1,16 @@
|
||||
# Copy to .env.local and adjust for your setup. Every value is optional — the app falls back
|
||||
# to local paths under ./data so it runs with no configuration at all.
|
||||
# Copy to .env (NOT .env.local) and adjust for your setup.
|
||||
#
|
||||
# Why .env and not .env.local: Next.js reads both, but the Prisma CLI only reads whatever its
|
||||
# config file loads — prisma.config.ts imports dotenv/config, which reads `.env`. Keeping
|
||||
# DATABASE_URL there means `prisma migrate deploy` and the app agree on the same database.
|
||||
#
|
||||
# Every value below is optional except DATABASE_URL — the app falls back to local paths under
|
||||
# ./data so it runs with almost no configuration.
|
||||
|
||||
# SQLite database — the single source of truth for records. Docker: /data/dnsmasq-admin.db
|
||||
DNSMASQ_ADMIN_DB_PATH=./data/dnsmasq-admin.db
|
||||
# Prisma connection URL for the SQLite database — the single source of truth for records.
|
||||
# Docker: /data/dnsmasq-admin.db
|
||||
# Relative paths resolve against the project root, not prisma/schema.prisma.
|
||||
DATABASE_URL="file:./data/dnsmasq-admin.db"
|
||||
|
||||
# Managed dnsmasq config file this app regenerates on every apply.
|
||||
# Docker: /etc/dnsmasq.d/dnsmasq-admin.conf
|
||||
|
||||
Reference in new issue
Block a user