feat: add Prisma schema, initial migration and idempotent seed

Model the whole domain: settings, the reference week, dated exceptions,
vacation periods, the public-holiday cache, display messages, the
translation cache, the audit log, and the device tables the BYOS server
needs (Device, DeviceLog, SyncState).

Two modelling decisions are load-bearing and documented in the schema:

- Opening times are wall-clock "HH:mm" strings in the shop timezone,
  never instants. Nothing is stored in UTC, which turns the March and
  October daylight-saving switches into non-events instead of edge cases.
- VacationPeriod is a source of truth, never expanded into
  ScheduleException rows. The resolver reads it directly at priority
  rank 2, so a holiday sync can never overwrite a manual exception and
  editing a period leaves no orphans behind.

Device access tokens are stored only as SHA-256 digests, and the image
filename column holds a content hash: the firmware skips the redraw when
the filename is unchanged, which is where the battery life comes from.

Prisma 7 no longer accepts the connection URL in the schema file, so it
moves to prisma.config.ts with the pg driver adapter.

The dev Postgres service lands here rather than with the rest of the
Docker work, because the migration needs a database to run against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012cSY9pVhZmJUKNN7wf1Myd
This commit is contained in:
2026-09-20 17:33:13 +02:00
co-authored by Claude Opus 5
parent a9809f83ca
commit 42ce09100e
12 changed files with 807 additions and 9 deletions
+1
View File
@@ -21,6 +21,7 @@ jobs:
node-version: '22'
cache: npm
- run: npm ci
- run: npx prisma generate
- run: npm run lint
- run: npm run typecheck
- run: npm run test