Use ordered SQLite migrations (Refs #75)
CI / checks (push) Successful in 5m6s

This commit is contained in:
2026-10-10 00:01:18 -04:00
parent a0663e43b8
commit 8d1bb69591
56 changed files with 1085 additions and 736 deletions
+5
View File
@@ -1,5 +1,7 @@
import type Database from 'better-sqlite3';
import { defaultFleetSettings } from '../../src/lib/fleet-settings.js';
import { migrateHostSchema } from '../../src/lib/server/hosts/schema.js';
import { migrateGameFileSchema } from '../../src/lib/server/game-files/schema.js';
export function initializeStandaloneSettings(handle: Database.Database) {
handle.exec(`CREATE TABLE IF NOT EXISTS settings (key TEXT PRIMARY KEY,value TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS retention_controls (category TEXT NOT NULL,record_id TEXT NOT NULL,protected INTEGER NOT NULL DEFAULT 0,resolved_at TEXT,PRIMARY KEY(category,record_id));
@@ -7,4 +9,7 @@ export function initializeStandaloneSettings(handle: Database.Database) {
handle
.prepare("INSERT OR IGNORE INTO settings(key,value) VALUES('fleet_settings',?)")
.run(JSON.stringify(defaultFleetSettings));
// These isolated library tests mock db(), bypassing startup migrations.
migrateHostSchema(handle);
migrateGameFileSchema(handle);
}