runtipi/packages/worker/assets/migrations/00005-add-user-operator.sql
2023-11-16 20:49:27 +01:00

18 lines
416 B
SQL

-- Create operator field if it doesn't exist
ALTER TABLE "user"
ADD COLUMN IF NOT EXISTS "operator" boolean DEFAULT NULL;
UPDATE
"user"
SET
"operator" = TRUE
WHERE
"operator" IS NULL;
-- Set operator column to default false
ALTER TABLE "user"
ALTER COLUMN "operator" SET DEFAULT FALSE;
-- Set operator column to not null constraint
ALTER TABLE "user"
ALTER COLUMN "operator" SET NOT NULL;