Ensure that stoptime and starttime are set for finished builds

This commit is contained in:
Eelco Dolstra
2013-05-23 12:05:12 -04:00
parent 57b2bb0674
commit b1f89bf92d
2 changed files with 13 additions and 0 deletions

10
src/sql/upgrade-15.sql Normal file
View File

@@ -0,0 +1,10 @@
-- Previously we didn't always set stoptime. For those builds, set
-- stoptime to timestamp, since back then timestamp was the time the
-- build finished (for finished builds).
update builds set stoptime = timestamp where finished = 1 and (stoptime is null or stoptime = 0);
-- Idem for starttime.
update builds set starttime = timestamp where finished = 1 and (starttime is null or starttime = 0);
alter table builds add check (finished = 0 or (stoptime is not null and stoptime != 0));
alter table builds add check (finished = 0 or (starttime is not null and starttime != 0));