Restrict admin to system management
This commit is contained in:
1 parent
0bef65ab75
commit
19e4621aeb
13 files changed
+634
-882
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user