diff --git a/src/sql/upgrade-62.sql b/src/sql/upgrade-62.sql new file mode 100644 index 000000000..a7476e68a --- /dev/null +++ b/src/sql/upgrade-62.sql @@ -0,0 +1,7 @@ +-- Make the Jobs.jobset_id column NOT NULL. If this upgrade fails, +-- either the admin didn't run the backfiller or there is a bug. If +-- the admin ran the backfiller and there are null columns, it is +-- very important to figure out where the nullable columns came from. + +ALTER TABLE Jobs + ALTER COLUMN jobset_id SET NOT NULL; diff --git a/src/sql/upgrade-63.sql b/src/sql/upgrade-63.sql index a7476e68a..76afa9e7b 100644 --- a/src/sql/upgrade-63.sql +++ b/src/sql/upgrade-63.sql @@ -1,7 +1,7 @@ --- Make the Jobs.jobset_id column NOT NULL. If this upgrade fails, +-- Make the Builds.jobset_id column NOT NULL. If this upgrade fails, -- either the admin didn't run the backfiller or there is a bug. If -- the admin ran the backfiller and there are null columns, it is -- very important to figure out where the nullable columns came from. -ALTER TABLE Jobs +ALTER TABLE Builds ALTER COLUMN jobset_id SET NOT NULL; diff --git a/src/sql/upgrade-64.sql b/src/sql/upgrade-64.sql index 76afa9e7b..05986887f 100644 --- a/src/sql/upgrade-64.sql +++ b/src/sql/upgrade-64.sql @@ -1,7 +1,4 @@ --- Make the Builds.jobset_id column NOT NULL. If this upgrade fails, --- either the admin didn't run the backfiller or there is a bug. If --- the admin ran the backfiller and there are null columns, it is --- very important to figure out where the nullable columns came from. - -ALTER TABLE Builds - ALTER COLUMN jobset_id SET NOT NULL; +-- Index more exactly what the latest-finished query looks for. +create index IndexFinishedSuccessfulBuilds + on Builds(id DESC, buildstatus, finished, job, jobset_id) + where buildstatus = 0 and finished = 1; diff --git a/src/sql/upgrade-65.sql b/src/sql/upgrade-65.sql deleted file mode 100644 index 05986887f..000000000 --- a/src/sql/upgrade-65.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Index more exactly what the latest-finished query looks for. -create index IndexFinishedSuccessfulBuilds - on Builds(id DESC, buildstatus, finished, job, jobset_id) - where buildstatus = 0 and finished = 1;