mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
Updates coder/customers#365 This PR updates our migration framework to run all migrations in a single transaction. This is the same behavior we had in v1 and ensures that failed migrations don't bring the whole deployment down. If a migration fails now, it will automatically be rolled back to the previous version, allowing the deployment to continue functioning.
35 lines
1.3 KiB
SQL
35 lines
1.3 KiB
SQL
CREATE TABLE workspace_agent_log_sources (
|
|
workspace_agent_id uuid NOT NULL REFERENCES workspace_agents(id) ON DELETE CASCADE,
|
|
id uuid NOT NULL,
|
|
created_at timestamptz NOT NULL,
|
|
display_name varchar(127) NOT NULL,
|
|
icon text NOT NULL,
|
|
PRIMARY KEY (workspace_agent_id, id)
|
|
);
|
|
|
|
CREATE TABLE workspace_agent_scripts (
|
|
workspace_agent_id uuid NOT NULL REFERENCES workspace_agents(id) ON DELETE CASCADE,
|
|
log_source_id uuid NOT NULL,
|
|
log_path text NOT NULL,
|
|
created_at timestamptz NOT NULL,
|
|
script text NOT NULL,
|
|
cron text NOT NULL,
|
|
start_blocks_login boolean NOT NULL,
|
|
run_on_start boolean NOT NULL,
|
|
run_on_stop boolean NOT NULL,
|
|
timeout_seconds integer NOT NULL
|
|
);
|
|
|
|
ALTER TABLE workspace_agent_logs ADD COLUMN log_source_id uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::uuid;
|
|
ALTER TABLE workspace_agent_logs DROP COLUMN source;
|
|
DROP TYPE workspace_agent_log_source;
|
|
|
|
ALTER TABLE workspace_agents DROP COLUMN startup_script_timeout_seconds;
|
|
ALTER TABLE workspace_agents DROP COLUMN shutdown_script;
|
|
ALTER TABLE workspace_agents DROP COLUMN shutdown_script_timeout_seconds;
|
|
ALTER TABLE workspace_agents DROP COLUMN startup_script_behavior;
|
|
ALTER TABLE workspace_agents DROP COLUMN startup_script;
|
|
|
|
-- Set the table to unlogged to speed up the inserts
|
|
ALTER TABLE workspace_agent_logs SET UNLOGGED;
|