Builds: add a nullable jobset_id foreign key to Jobsets.
Also, adds an explicitly named "builds" accessor to the Jobsets Schema object, which uses the project/jobset name.
This commit is contained in:
@ -170,6 +170,7 @@ create table Builds (
|
||||
-- Info about the inputs.
|
||||
project text not null,
|
||||
jobset text not null,
|
||||
jobset_id integer null,
|
||||
job text not null,
|
||||
|
||||
-- Info about the build result.
|
||||
@ -236,6 +237,7 @@ create table Builds (
|
||||
check (finished = 0 or (stoptime is not null and stoptime != 0)),
|
||||
check (finished = 0 or (starttime is not null and starttime != 0)),
|
||||
|
||||
foreign key (jobset_id) references Jobsets(id) on delete cascade,
|
||||
foreign key (project) references Projects(name) on update cascade,
|
||||
foreign key (project, jobset) references Jobsets(project, name) on update cascade,
|
||||
foreign key (project, jobset, job) references Jobs(project, jobset, name) on update cascade
|
||||
|
10
src/sql/upgrade-61.sql
Normal file
10
src/sql/upgrade-61.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- Add the jobset_id columns to the Builds table. This will go
|
||||
-- quickly, since the field is nullable. Note this is just part one of
|
||||
-- this migration. Future steps involve a piecemeal backfilling, and
|
||||
-- then making the column non-null.
|
||||
|
||||
ALTER TABLE Builds
|
||||
ADD COLUMN jobset_id integer NULL,
|
||||
ADD FOREIGN KEY (jobset_id)
|
||||
REFERENCES Jobsets(id)
|
||||
ON DELETE CASCADE;
|
Reference in New Issue
Block a user