16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/fun_ci/persistence/database.rb', line 16
def self.migrate!(db)
db.execute(<<~SQL)
CREATE TABLE IF NOT EXISTS pipeline_runs (
id INTEGER PRIMARY KEY,
commit_hash TEXT,
branch TEXT,
status TEXT DEFAULT 'scheduled',
pid INTEGER,
created_at TEXT,
updated_at TEXT
)
SQL
add_column_if_missing(db, "pipeline_runs", "pid", "INTEGER")
add_column_if_missing(db, "pipeline_runs", "project_path", "TEXT")
db.execute(<<~SQL)
CREATE TABLE IF NOT EXISTS stage_jobs (
id INTEGER PRIMARY KEY,
pipeline_run_id INTEGER REFERENCES pipeline_runs(id),
stage TEXT,
status TEXT DEFAULT 'scheduled',
started_at TEXT,
completed_at TEXT
)
SQL
end
|