diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 53454867..937bd5fc 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -68,7 +68,7 @@ __PACKAGE__->table("builds"); data_type: 'integer' is_foreign_key: 1 - is_nullable: 1 + is_nullable: 0 =head2 job @@ -222,7 +222,7 @@ __PACKAGE__->add_columns( "jobset", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "jobset_id", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "job", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "nixname", @@ -466,12 +466,7 @@ __PACKAGE__->belongs_to( "jobset", "Hydra::Schema::Jobsets", { id => "jobset_id" }, - { - is_deferrable => 0, - join_type => "LEFT", - on_delete => "CASCADE", - on_update => "NO ACTION", - }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); =head2 jobset_project_jobset @@ -578,8 +573,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:32:28 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RvrINOAowDcde8Nd9VD6rQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:34:25 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EEXlcKN/ydXJ129vT0jTUw __PACKAGE__->has_many( "dependents", diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index f6c05bf7..f1d143dc 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -170,7 +170,7 @@ create table Builds ( -- Info about the inputs. project text not null, jobset text not null, - jobset_id integer null, + jobset_id integer not null, job text not null, -- Info about the build result. diff --git a/src/sql/upgrade-64.sql b/src/sql/upgrade-64.sql new file mode 100644 index 00000000..76afa9e7 --- /dev/null +++ b/src/sql/upgrade-64.sql @@ -0,0 +1,7 @@ +-- 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;