Add reason field for workspace builds (#2438)

* add reason field for workspace build

* add the reason field to FE via API

* update BuildReasonMember to BuildReasonInitiator

* add unit tests

* add more unit tests

* add error for unknown transition

* fix lint

* add documentation

* fix unit tests

* fix generated types

* remove nested transaction

* rename migration file
This commit is contained in:
Abhineet Jain
2022-06-17 13:41:11 -04:00
committed by GitHub
parent 7dcfea10dc
commit 289b98978f
15 changed files with 111 additions and 17 deletions

View File

@ -6,6 +6,12 @@ CREATE TYPE audit_action AS ENUM (
'delete'
);
CREATE TYPE build_reason AS ENUM (
'initiator',
'autostart',
'autostop'
);
CREATE TYPE log_level AS ENUM (
'trace',
'debug',
@ -311,7 +317,8 @@ CREATE TABLE workspace_builds (
initiator_id uuid NOT NULL,
provisioner_state bytea,
job_id uuid NOT NULL,
deadline timestamp with time zone DEFAULT '0001-01-01 00:00:00+00'::timestamp with time zone NOT NULL
deadline timestamp with time zone DEFAULT '0001-01-01 00:00:00+00'::timestamp with time zone NOT NULL,
reason build_reason DEFAULT 'initiator'::public.build_reason NOT NULL
);
CREATE TABLE workspace_resources (