Jobs.jobset_id: make not-null

This commit is contained in:
Graham Christensen 2020-02-05 19:42:07 -05:00
parent add4f610ce
commit 2cdcc7f188
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F
3 changed files with 13 additions and 11 deletions

View file

@ -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;

View file

@ -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),

7
src/sql/upgrade-63.sql Normal file
View file

@ -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;