| 40dd3f86 Andy McCall ↶ |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
CREATE TABLE coverage_reports_new ( |
| 7 |
id INTEGER PRIMARY KEY, |
| 8 |
repo_id INTEGER NOT NULL REFERENCES repositories(id) ON DELETE CASCADE, |
| 9 |
run_id INTEGER REFERENCES flow_runs(id) ON DELETE CASCADE, |
| 10 |
job_id INTEGER UNIQUE, |
| 11 |
job TEXT NOT NULL, |
| 12 |
run_number INTEGER NOT NULL, |
| 13 |
bookmark TEXT NOT NULL, |
| 14 |
state TEXT NOT NULL, |
| 15 |
heads TEXT NOT NULL, |
| 16 |
blob TEXT NOT NULL, |
| 17 |
format TEXT NOT NULL, |
| 18 |
lines_found INTEGER NOT NULL, |
| 19 |
lines_hit INTEGER NOT NULL, |
| 20 |
functions_found INTEGER NOT NULL, |
| 21 |
functions_hit INTEGER NOT NULL, |
| 22 |
branches_found INTEGER NOT NULL, |
| 23 |
branches_hit INTEGER NOT NULL, |
| 24 |
hits INTEGER NOT NULL DEFAULT 0, |
| 25 |
files INTEGER NOT NULL, |
| 26 |
dropped INTEGER NOT NULL, |
| 27 |
created_ms INTEGER NOT NULL, |
| 28 |
|
| 29 |
uploader TEXT NOT NULL DEFAULT '' |
| 30 |
); |
| 31 |
INSERT INTO coverage_reports_new (id, repo_id, run_id, job_id, job, run_number, bookmark, state, heads, blob, format, |
| 32 |
lines_found, lines_hit, functions_found, functions_hit, branches_found, branches_hit, hits, files, dropped, created_ms) |
| 33 |
SELECT id, repo_id, run_id, job_id, job, run_number, bookmark, state, heads, blob, format, |
| 34 |
lines_found, lines_hit, functions_found, functions_hit, branches_found, branches_hit, hits, files, dropped, created_ms |
| 35 |
FROM coverage_reports; |
| 36 |
CREATE TABLE coverage_files_new ( |
| 37 |
report_id INTEGER NOT NULL REFERENCES coverage_reports_new(id) ON DELETE CASCADE, |
| 38 |
path TEXT NOT NULL, |
| 39 |
lines_found INTEGER NOT NULL, |
| 40 |
lines_hit INTEGER NOT NULL, |
| 41 |
functions_found INTEGER NOT NULL, |
| 42 |
functions_hit INTEGER NOT NULL, |
| 43 |
branches_found INTEGER NOT NULL, |
| 44 |
branches_hit INTEGER NOT NULL, |
| 45 |
PRIMARY KEY (report_id, path) |
| 46 |
); |
| 47 |
INSERT INTO coverage_files_new SELECT * FROM coverage_files; |
| 48 |
DROP TABLE coverage_files; |
| 49 |
DROP TABLE coverage_reports; |
| 50 |
ALTER TABLE coverage_reports_new RENAME TO coverage_reports; |
| 51 |
ALTER TABLE coverage_files_new RENAME TO coverage_files; |
| 52 |
CREATE INDEX coverage_reports_bookmark ON coverage_reports (repo_id, bookmark, created_ms); |