Restrict admin to system management

This commit is contained in:
michael committed 2026-08-06 08:07:26 +02:00
1 parent 0bef65ab75
commit 19e4621aeb
13 files changed
+634 -882

No files matched your search

+3
View File
@@ -76,6 +76,9 @@ export async function migrate() {
const adminId = await ensureMigrationAdmin();
await query("UPDATE users SET role = 'user', updated_at = now() WHERE role = 'admin' AND id <> $1;", [adminId]);
await query("CREATE UNIQUE INDEX IF NOT EXISTS idx_users_single_admin ON users ((role)) WHERE role = 'admin';");
await query(`
CREATE TABLE IF NOT EXISTS app_settings (
key TEXT PRIMARY KEY,