mirror of
https://github.com/zoriya/cish.git
synced 2025-12-05 23:06:18 +00:00
38 lines
848 B
PL/PgSQL
38 lines
848 B
PL/PgSQL
begin;
|
|
|
|
create type event as enum('push', 'pull_request', 'tags');
|
|
create type status as enum('finished', 'waiting', 'running', 'error');
|
|
|
|
create table jobs(
|
|
id int not null primary key,
|
|
handle uuid not null,
|
|
name varchar(255) not null,
|
|
|
|
repository_id int not null references repositories(id) on delete cascade,
|
|
ref varchar not null,
|
|
event event not null,
|
|
|
|
started_at timestamptz not null,
|
|
finished_at timestamptz,
|
|
status status not null,
|
|
|
|
parent int references jobs(id) on delete cascade
|
|
);
|
|
|
|
create type bash_type as enum('command', 'loop', 'if');
|
|
|
|
create table job_step(
|
|
id int not null primary key,
|
|
job_id int not null references jobs(id) on delete cascade,
|
|
command text not null,
|
|
type bash_type not null,
|
|
status status not null,
|
|
exit_code int,
|
|
logs text not null,
|
|
|
|
started_at timestamptz,
|
|
finished_at timestamptz
|
|
);
|
|
|
|
commit;
|