Files
cish/api/migrations/000001_jobs.up.sql
2025-08-24 00:51:34 +02:00

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;