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
+1 -4
View File
@@ -1,7 +1,5 @@
import type Database from 'better-sqlite3';
const initialized = new WeakSet<Database.Database>();
export function ensureAuthSchema(handle: Database.Database): void {
if (initialized.has(handle)) return;
export function migrateAuthSchema(handle: Database.Database): void {
handle.exec(`
CREATE TABLE IF NOT EXISTS auth_users (
id TEXT PRIMARY KEY, username TEXT NOT NULL COLLATE NOCASE UNIQUE,
@@ -24,5 +22,4 @@ export function ensureAuthSchema(handle: Database.Database): void {
);
CREATE INDEX IF NOT EXISTS auth_audit_created_at ON auth_audit(created_at);
`);
initialized.add(handle);
}