Builds.jobset_id: make not-null

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

View file

@ -68,7 +68,7 @@ __PACKAGE__->table("builds");
data_type: 'integer' data_type: 'integer'
is_foreign_key: 1 is_foreign_key: 1
is_nullable: 1 is_nullable: 0
=head2 job =head2 job
@ -222,7 +222,7 @@ __PACKAGE__->add_columns(
"jobset", "jobset",
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 }, { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
"jobset_id", "jobset_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"job", "job",
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 }, { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
"nixname", "nixname",
@ -466,12 +466,7 @@ __PACKAGE__->belongs_to(
"jobset", "jobset",
"Hydra::Schema::Jobsets", "Hydra::Schema::Jobsets",
{ id => "jobset_id" }, { id => "jobset_id" },
{ { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
is_deferrable => 0,
join_type => "LEFT",
on_delete => "CASCADE",
on_update => "NO ACTION",
},
); );
=head2 jobset_project_jobset =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 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:34:25
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RvrINOAowDcde8Nd9VD6rQ # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EEXlcKN/ydXJ129vT0jTUw
__PACKAGE__->has_many( __PACKAGE__->has_many(
"dependents", "dependents",

View file

@ -170,7 +170,7 @@ create table Builds (
-- Info about the inputs. -- Info about the inputs.
project text not null, project text not null,
jobset text not null, jobset text not null,
jobset_id integer null, jobset_id integer not null,
job text not null, job text not null,
-- Info about the build result. -- Info about the build result.

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

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