1
0

feat: schema versioning with v2 migration (loans, last_played_at)

This commit is contained in:
2026-09-03 20:43:33 +02:00
parent bc3db9e4f7
commit 3bdbd8315c
4 changed files with 108 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import crypto from 'node:crypto'
export interface Config {
dataDir: string
artworkDir: string
backupsDir: string
dbPath: string
port: number
sessionSecret: string
@@ -15,9 +16,12 @@ export function loadConfig(env: Record<string, string | undefined> = process.env
mkdirSync(dataDir, { recursive: true })
const artworkDir = path.join(dataDir, 'artwork-cache')
mkdirSync(artworkDir, { recursive: true })
const backupsDir = path.join(dataDir, 'backups')
mkdirSync(backupsDir, { recursive: true })
return {
dataDir,
artworkDir,
backupsDir,
dbPath: path.join(dataDir, 'record-shop.db'),
port: Number(env.PORT ?? 3000),
sessionSecret: getOrCreateSecret(dataDir),