last changed.
RAKTHYAIX757GPYWCHOE5H5RD3QYKQW3QKLWUIUKPHQ5QGWQXWQQC
TCHEWSZLG3PX7JFBLYO5ASBYAGZU4TWUYZQGNXPHQ3J7DILQPYGAC
K4C6DNSM7ARO6I24TEXIAHJ4XM7P3MXTXEPXKGDEAKALBL4RJQVAC
7ZSVXUGFXOI3BOJE37SXIT6MDN6AJRBCCJNEICYDMBJF5QOEY6BAC
OG7BEM57MXPCG56IT5GODPFG77KZXWPXZ7OVZPWQQ56CRJ7KUE2QC
UUGBVEGYV3FUNL7D3ECA2DIMFHE2S5UQF4ACSLESX3M3NRYYE57AC
ZD5AEKWMW6IFFW46BJEFRPXRWMXTKCM4CSES6YTUOY7DEUX3E7JQC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
75XUS62YF7OK4S45RCZ5OOASXEBIEDNDBYEEMOCBDHVXV4GA3NLQC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
7PYQLDQLHIFHIAZZKBEQ36QMRNZFDWCAVCIHYO3V7JRV36AG5SBAC
SJN2QPWHFYKX7CJMW4XZHI2P2THH7MECZZIHQMCH6EKBZ45G3DOAC
JLDUSNUOOQNL63BOPXIWZOWFRQ5X35RWG33PJB3J3KMR6QR7TN7QC
IK53RV4VGOHLCZGQCCIKPB45M3C7M7YMNBOJFBGZJ4LWIZNU4QNQC
YTSIRIMKV2EN6CMO6LFX5J3NBJJYWBJKYDU3Z53CGXCIWP3FYI2QC
7Z3YOKCVJE242IDO4HQVOBBLHFOXXCQIBIKDIUXQLTU5LY5QAORQC
N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC
* select x.project, x.jobset, x.job, x.system, x.id, x.timestamp, r.buildstatus, b.id, b.timestamp
from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 group by project, jobset, job, system) as a_
natural join Builds x
natural join BuildResultInfo r
left join Builds b on b.id =
(select max(id) from builds c
natural join buildresultinfo r2
where x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system
and x.id > c.id and r.buildstatus != r2.buildstatus);
makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as a natural join Builds");
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as a natural join Builds");
my $joinWithStatusChange =
"natural join BuildResultInfo r " .
"left join Builds b on b.id = " .
"(select max(id) from builds c natural join buildresultinfo r2 " .
" where x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system and " .
" x.id > c.id and r.buildstatus != r2.buildstatus)";
makeSource('JobStatus' . $name, "select *, b.id statusChangeId, b.timestamp statusChangeTime from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as latest natural join Builds x $joinWithStatusChange");
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as latest natural join Builds x $joinWithStatusChange");
[% IF showStatusChange %]
<td>
[% IF build.get_column('statusChangeTime') %]
<a href="[% c.uri_for('/build' build.get_column('statusChangeId')) %]">
[% date.format(build.get_column('statusChangeTime'), '%Y-%m-%d %H:%M:%S') %]
</a>
[% ELSE %]
<em>never</em>
[% END %]
</td>
[% END %]
<p>Below are the latest builds for each job.</p>
<p>Below are the latest builds for each job. It is ordered by the status
change time (the timestamp of the last build that had a different
build result status). That is, it shows the jobs that most recently
changed from failed to successful or vice versa first.</p>
--create index IndexBuildsByJobAndSystem on Builds(project, jobset, job, system);
create index IndexBuildsByJobAndSystem on Builds(project, jobset, job, system);
create index IndexBuildResultInfo on BuildResultInfo(id); -- primary key index, not created automatically by PostgreSQL