11 lines
334 B
SQL
11 lines
334 B
SQL
ALTER TABLE users
|
|
ADD COLUMN platform_admin BOOLEAN NOT NULL DEFAULT false;
|
|
|
|
-- Existing deployments: promote the earliest account if none is admin yet.
|
|
UPDATE users
|
|
SET platform_admin = true
|
|
WHERE id = (
|
|
SELECT id FROM users ORDER BY created_at ASC LIMIT 1
|
|
)
|
|
AND NOT EXISTS (SELECT 1 FROM users WHERE platform_admin = true);
|