runtipi/packages/worker/assets/migrations/00004-add-exposed-domain-fields.sql
2023-11-16 20:49:27 +01:00

23 lines
584 B
SQL

-- Create exposed field if it doesn't exist
ALTER TABLE "app"
ADD COLUMN IF NOT EXISTS "exposed" boolean DEFAULT FALSE;
-- Select all apps that have not the exposed field and put it to false
UPDATE
"app"
SET
"exposed" = FALSE
WHERE
"exposed" IS NULL;
-- Set exposed column to not null constraint
ALTER TABLE "app"
ALTER COLUMN "exposed" SET NOT NULL;
-- Create domain column if it doesn't exist
ALTER TABLE "app"
ADD COLUMN IF NOT EXISTS "domain" character varying;
-- Set default version to 1
ALTER TABLE "app"
ALTER COLUMN "version" SET DEFAULT '1';