diff --git a/src/lib/Hydra/Schema/Jobs.pm b/src/lib/Hydra/Schema/Jobs.pm index d4126e32..b00f3e0f 100644 --- a/src/lib/Hydra/Schema/Jobs.pm +++ b/src/lib/Hydra/Schema/Jobs.pm @@ -51,7 +51,7 @@ __PACKAGE__->table("jobs"); data_type: 'integer' is_foreign_key: 1 - is_nullable: 1 + is_nullable: 0 =head2 name @@ -66,7 +66,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 }, "name", { data_type => "text", is_nullable => 0 }, ); @@ -139,12 +139,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 @@ -197,7 +192,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:30:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dFusVjxb423gIEoadAw9sw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:33:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:C5Tyh8Ke4yC6q7KIFVOHcQ 1; diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 8349e3be..f6c05bf7 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -146,7 +146,7 @@ create table JobsetInputAlts ( create table Jobs ( project text not null, jobset text not null, - jobset_id integer null, + jobset_id integer not null, name text not null, primary key (project, jobset, name), diff --git a/src/sql/upgrade-63.sql b/src/sql/upgrade-63.sql new file mode 100644 index 00000000..a7476e68 --- /dev/null +++ b/src/sql/upgrade-63.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;