mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
22 lines
816 B
PL/PgSQL
22 lines
816 B
PL/PgSQL
BEGIN;
|
|
|
|
-- Add "exectrace" to workspace_agent_subsystem type.
|
|
ALTER TYPE workspace_agent_subsystem ADD VALUE 'exectrace';
|
|
|
|
-- Create column subsystems in workspace_agents table, with default value being
|
|
-- an empty array.
|
|
ALTER TABLE workspace_agents ADD COLUMN subsystems workspace_agent_subsystem[] DEFAULT '{}';
|
|
|
|
-- Add a constraint that the subsystems cannot contain the deprecated value
|
|
-- 'none'.
|
|
ALTER TABLE workspace_agents ADD CONSTRAINT subsystems_not_none CHECK (NOT ('none' = ANY (subsystems)));
|
|
|
|
-- Update all existing workspace_agents to have subsystems = [subsystem] unless
|
|
-- the subsystem is 'none'.
|
|
UPDATE workspace_agents SET subsystems = ARRAY[subsystem] WHERE subsystem != 'none';
|
|
|
|
-- Drop the subsystem column from workspace_agents.
|
|
ALTER TABLE workspace_agents DROP COLUMN subsystem;
|
|
|
|
COMMIT;
|