Files
coder/coderd/database/migrations/000157_workspace_agent_script.down.sql
Kyle Carberry 1262eef2c0 feat: add support for coder_script (#9584)
* Add basic migrations

* Improve schema

* Refactor agent scripts into it's own package

* Support legacy start and stop script format

* Pipe the scripts!

* Finish the piping

* Fix context usage

* It works!

* Fix sql query

* Fix SQL query

* Rename `LogSourceID` -> `SourceID`

* Fix the FE

* fmt

* Rename migrations

* Fix log tests

* Fix lint err

* Fix gen

* Fix story type

* Rename source to script

* Fix schema jank

* Uncomment test

* Rename proto to TimeoutSeconds

* Fix comments

* Fix comments

* Fix legacy endpoint without specified log_source

* Fix non-blocking by default in agent

* Fix resources tests

* Fix dbfake

* Fix resources

* Fix linting I think

* Add fixtures

* fmt

* Fix startup script behavior

* Fix comments

* Fix context

* Fix cancel

* Fix SQL tests

* Fix e2e tests

* Interrupt on Windows

* Fix agent leaking script process

* Fix migrations

* Fix stories

* Fix duplicate logs appearing

* Gen

* Fix log location

* Fix tests

* Fix tests

* Fix log output

* Show display name in output

* Fix print

* Return timeout on start context

* Gen

* Fix fixture

* Fix the agent status

* Fix startup timeout msg

* Fix command using shared context

* Fix timeout draining

* Change signal type

* Add deterministic colors to startup script logs

---------

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
2023-09-25 16:47:17 -05:00

24 lines
964 B
PL/PgSQL

BEGIN;
ALTER TABLE workspace_agent_logs SET LOGGED;
-- Revert the workspace_agents table to its former state
ALTER TABLE workspace_agents ADD COLUMN startup_script text;
ALTER TABLE workspace_agents ADD COLUMN startup_script_behavior text;
ALTER TABLE workspace_agents ADD COLUMN shutdown_script_timeout_seconds integer;
ALTER TABLE workspace_agents ADD COLUMN shutdown_script text;
ALTER TABLE workspace_agents ADD COLUMN startup_script_timeout_seconds integer;
-- Reinstate the dropped type
CREATE TYPE workspace_agent_log_source AS ENUM ('startup_script', 'shutdown_script', 'kubernetes_logs', 'envbox', 'envbuilder', 'external');
-- Add old source column back with enum type and drop log_source_id
ALTER TABLE workspace_agent_logs ADD COLUMN source workspace_agent_log_source;
ALTER TABLE workspace_agent_logs DROP COLUMN log_source_id;
-- Drop the newly created tables
DROP TABLE workspace_agent_scripts;
DROP TABLE workspace_agent_log_sources;
COMMIT;