feat: add unique super administrator and role management

This commit is contained in:
wlx committed 2026-09-17 19:03:51 +08:00
1 parent 9e731e47b9
commit 386d15cde2
16 files changed
+455 -24

No files matched your search

@@ -0,0 +1,8 @@
-- Keep one protected platform owner while retaining a lower-privilege operator role.
ALTER TABLE users DROP CONSTRAINT IF EXISTS users_role_check;
ALTER TABLE users
ADD CONSTRAINT users_role_check CHECK (role IN ('user', 'admin', 'super_admin'));
CREATE UNIQUE INDEX IF NOT EXISTS users_single_super_admin_idx
ON users (role)
WHERE role = 'super_admin';