mirror of
https://github.com/zoriya/cish.git
synced 2025-12-05 23:06:18 +00:00
Create jobs migrations
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
cish start postgres
|
||||
|
||||
if [[ true ]]; then
|
||||
true
|
||||
fi
|
||||
|
||||
for job in v1.22.0 v1.0.0 titi; do
|
||||
cish run ../ex.sh --version=$job
|
||||
|
||||
|
||||
7
.pg_format
Normal file
7
.pg_format
Normal file
@@ -0,0 +1,7 @@
|
||||
tabs=1
|
||||
function-case=1 #lowercase
|
||||
keyword-case=1
|
||||
type-case=1
|
||||
no-space-function=1
|
||||
keep-newline=1
|
||||
nogrouping=1
|
||||
@@ -3,9 +3,11 @@ module github.com/zoriya/cish/api
|
||||
go 1.24.5
|
||||
|
||||
require (
|
||||
github.com/go-git/go-git/v6 v6.0.0-20250819122726-39261590f7f3
|
||||
github.com/jackc/pgx/v5 v5.7.5
|
||||
github.com/labstack/echo/v4 v4.13.4
|
||||
github.com/ren3gadem4rm0t/github-hook-types-go v0.1.1
|
||||
github.com/spf13/viper v1.20.1
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -18,7 +20,6 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||
github.com/go-git/gcfg/v2 v2.0.2 // indirect
|
||||
github.com/go-git/go-billy/v6 v6.0.0-20250627091229-31e2a16eef30 // indirect
|
||||
github.com/go-git/go-git/v6 v6.0.0-20250819122726-39261590f7f3 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/google/go-github/v74 v74.0.0 // indirect
|
||||
@@ -39,7 +40,6 @@ require (
|
||||
github.com/spf13/afero v1.12.0 // indirect
|
||||
github.com/spf13/cast v1.7.1 // indirect
|
||||
github.com/spf13/pflag v1.0.6 // indirect
|
||||
github.com/spf13/viper v1.20.1 // indirect
|
||||
github.com/src-d/gcfg v1.4.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
|
||||
5
api/job.go
Normal file
5
api/job.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package main
|
||||
|
||||
func CreateJob(script string) {
|
||||
|
||||
}
|
||||
10
api/migrations/000001_jobs.down.sql
Normal file
10
api/migrations/000001_jobs.down.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
begin;
|
||||
|
||||
drop table job_step;
|
||||
drop table jobs;
|
||||
|
||||
drop type event;
|
||||
drop type status;
|
||||
drop type bash_type;
|
||||
|
||||
commit;
|
||||
37
api/migrations/000001_jobs.up.sql
Normal file
37
api/migrations/000001_jobs.up.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user