Stabilize core: better-sqlite3, versioned migrations, graceful shutdown

- Replace experimental node:sqlite with better-sqlite3 (stable API)
- Replace try/catch migration pattern with schema_version tracking
- Add SIGTERM/SIGINT handler for clean shutdown (DB flush, scheduler stop)
- Fix BudgetPanel crash: remove undefined setShowAddCategory call
- Update Dockerfile: remove --experimental-sqlite, add native build tools
This commit is contained in:
Maurice
2026-03-22 17:52:24 +01:00
parent 3919c61eb6
commit d604ad1c5b
8 changed files with 472 additions and 55 deletions

View File

@@ -1,9 +1,9 @@
const path = require('path');
const { DatabaseSync } = require('node:sqlite');
const Database = require('better-sqlite3');
const bcrypt = require('bcryptjs');
const dbPath = path.join(__dirname, 'data/travel.db');
const db = new DatabaseSync(dbPath);
const db = new Database(dbPath);
const hash = bcrypt.hashSync('admin123', 10);
const existing = db.prepare('SELECT id FROM users WHERE email = ?').get('admin@admin.com');