-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP VIEW release_build_status; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE OR REPLACE VIEW release_build_status AS ( | ||
SELECT | ||
summary.id, | ||
summary.last_build_time, | ||
CASE | ||
WHEN summary.success_count > 0 THEN 'success'::build_status | ||
WHEN summary.failure_count > 0 THEN 'failure'::build_status | ||
ELSE 'in_progress'::build_status | ||
END as build_status | ||
|
||
FROM ( | ||
SELECT | ||
r.id, | ||
MAX(b.build_time) as last_build_time, | ||
SUM(CASE WHEN b.build_status = 'success' THEN 1 ELSE 0 END) as success_count, | ||
SUM(CASE WHEN b.build_status = 'failure' THEN 1 ELSE 0 END) as failure_count | ||
FROM | ||
releases as r | ||
LEFT OUTER JOIN builds AS b on b.rid = r.id | ||
GROUP BY r.id | ||
) as summary | ||
); |