From c2f932a7e3850048498938836797ee14ec916047 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 6 Feb 2020 12:23:47 -0500 Subject: [PATCH 1/9] sql: Generate models from postgresql Lowercasing is due to postgresql not having case-sensitive table names. It always technically workde before, but those table names never existed literally. The switch to generating from postgresql is to handle an upcoming addition of an auto-incrementign ID to the Jobset table. Sqlite doesn't seem to be able to handle the table having an auto incrementing ID field which isn't the primary key, but we can't change the primary key trivially. Since hydra doesn't support sqlite and hasn't for many year anyway, it is easier to just generate from pgsql directly. --- src/lib/Hydra/Schema/AggregateConstituents.pm | 8 ++-- src/lib/Hydra/Schema/BuildInputs.pm | 16 +++++-- src/lib/Hydra/Schema/BuildMetrics.pm | 8 ++-- src/lib/Hydra/Schema/BuildOutputs.pm | 8 ++-- src/lib/Hydra/Schema/BuildProducts.pm | 8 ++-- src/lib/Hydra/Schema/BuildStepOutputs.pm | 8 ++-- src/lib/Hydra/Schema/BuildSteps.pm | 8 ++-- src/lib/Hydra/Schema/Builds.pm | 16 +++++-- src/lib/Hydra/Schema/CachedBazaarInputs.pm | 8 ++-- src/lib/Hydra/Schema/CachedCVSInputs.pm | 8 ++-- src/lib/Hydra/Schema/CachedDarcsInputs.pm | 8 ++-- src/lib/Hydra/Schema/CachedGitInputs.pm | 8 ++-- src/lib/Hydra/Schema/CachedHgInputs.pm | 8 ++-- src/lib/Hydra/Schema/CachedPathInputs.pm | 8 ++-- .../Hydra/Schema/CachedSubversionInputs.pm | 8 ++-- src/lib/Hydra/Schema/FailedPaths.pm | 8 ++-- src/lib/Hydra/Schema/Jobs.pm | 8 ++-- src/lib/Hydra/Schema/JobsetEvalInputs.pm | 8 ++-- src/lib/Hydra/Schema/JobsetEvalMembers.pm | 8 ++-- src/lib/Hydra/Schema/JobsetEvals.pm | 16 +++++-- src/lib/Hydra/Schema/JobsetInputAlts.pm | 8 ++-- src/lib/Hydra/Schema/JobsetInputs.pm | 27 ++--------- src/lib/Hydra/Schema/JobsetRenames.pm | 8 ++-- src/lib/Hydra/Schema/Jobsets.pm | 29 +++--------- src/lib/Hydra/Schema/NewsItems.pm | 16 +++++-- src/lib/Hydra/Schema/NrBuilds.pm | 8 ++-- src/lib/Hydra/Schema/ProjectMembers.pm | 8 ++-- src/lib/Hydra/Schema/Projects.pm | 8 ++-- src/lib/Hydra/Schema/ReleaseMembers.pm | 8 ++-- src/lib/Hydra/Schema/Releases.pm | 8 ++-- src/lib/Hydra/Schema/SchemaVersion.pm | 8 ++-- src/lib/Hydra/Schema/StarredJobs.pm | 8 ++-- src/lib/Hydra/Schema/SystemStatus.pm | 8 ++-- src/lib/Hydra/Schema/SystemTypes.pm | 8 ++-- src/lib/Hydra/Schema/UriRevMapper.pm | 8 ++-- src/lib/Hydra/Schema/UserRoles.pm | 8 ++-- src/lib/Hydra/Schema/Users.pm | 8 ++-- src/sql/Makefile.am | 10 +--- src/sql/update-dbix-harness.sh | 40 ++++++++++++++++ src/sql/update-dbix.pl | 47 +++++++++++++++++-- 40 files changed, 264 insertions(+), 201 deletions(-) create mode 100755 src/sql/update-dbix-harness.sh diff --git a/src/lib/Hydra/Schema/AggregateConstituents.pm b/src/lib/Hydra/Schema/AggregateConstituents.pm index 8112a49c..c4de2170 100644 --- a/src/lib/Hydra/Schema/AggregateConstituents.pm +++ b/src/lib/Hydra/Schema/AggregateConstituents.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("AggregateConstituents"); +__PACKAGE__->table("aggregateconstituents"); =head1 ACCESSORS @@ -103,8 +103,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-15 00:20:01 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TLNenyPLIWw2gWsOVhplZw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bQfQoSstlaFy7zw8i1R+ow # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildInputs.pm b/src/lib/Hydra/Schema/BuildInputs.pm index ce1b7320..65b936b1 100644 --- a/src/lib/Hydra/Schema/BuildInputs.pm +++ b/src/lib/Hydra/Schema/BuildInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildInputs"); +__PACKAGE__->table("buildinputs"); =head1 ACCESSORS @@ -40,6 +40,7 @@ __PACKAGE__->table("BuildInputs"); data_type: 'integer' is_auto_increment: 1 is_nullable: 0 + sequence: 'buildinputs_id_seq' =head2 build @@ -98,7 +99,12 @@ __PACKAGE__->table("BuildInputs"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "buildinputs_id_seq", + }, "build", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "name", @@ -176,8 +182,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-08 13:08:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OaJPzRM+8XGsu3eIkqeYEw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/Fwb8emBsvwrZlEab2X+gQ my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/BuildMetrics.pm b/src/lib/Hydra/Schema/BuildMetrics.pm index 58bbed94..324d69e8 100644 --- a/src/lib/Hydra/Schema/BuildMetrics.pm +++ b/src/lib/Hydra/Schema/BuildMetrics.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildMetrics"); +__PACKAGE__->table("buildmetrics"); =head1 ACCESSORS @@ -177,8 +177,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:52:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qoPm5/le+sVHigW4Dmum2Q +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Roy7h/K9u7DQOzet4B1sbA sub json_hint { return { columns => ['value', 'unit'] }; diff --git a/src/lib/Hydra/Schema/BuildOutputs.pm b/src/lib/Hydra/Schema/BuildOutputs.pm index 751eac4b..4a2b00f7 100644 --- a/src/lib/Hydra/Schema/BuildOutputs.pm +++ b/src/lib/Hydra/Schema/BuildOutputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildOutputs"); +__PACKAGE__->table("buildoutputs"); =head1 ACCESSORS @@ -94,8 +94,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:V8MbzKvZNEaeHBJV67+ZMQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:71R9clwAP6vzDh10EukTaw my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/BuildProducts.pm b/src/lib/Hydra/Schema/BuildProducts.pm index bba1d601..f52b2937 100644 --- a/src/lib/Hydra/Schema/BuildProducts.pm +++ b/src/lib/Hydra/Schema/BuildProducts.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildProducts"); +__PACKAGE__->table("buildproducts"); =head1 ACCESSORS @@ -143,8 +143,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2016-04-13 14:49:33 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kONECZn56f7sqfrLviiUOQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iI0gmKqQxiPBTy5QsM6tpQ my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/BuildStepOutputs.pm b/src/lib/Hydra/Schema/BuildStepOutputs.pm index 8eca1be3..19034c9b 100644 --- a/src/lib/Hydra/Schema/BuildStepOutputs.pm +++ b/src/lib/Hydra/Schema/BuildStepOutputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildStepOutputs"); +__PACKAGE__->table("buildstepoutputs"); =head1 ACCESSORS @@ -119,8 +119,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A/4v3ugXYbuYoKPlOvC6mg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Y6DpbTM6z4cOGoYIhD3i1A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/BuildSteps.pm b/src/lib/Hydra/Schema/BuildSteps.pm index bf572fcf..dd6a4dbf 100644 --- a/src/lib/Hydra/Schema/BuildSteps.pm +++ b/src/lib/Hydra/Schema/BuildSteps.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("BuildSteps"); +__PACKAGE__->table("buildsteps"); =head1 ACCESSORS @@ -215,8 +215,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-12-07 13:48:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3FYkqSUfgWmiqZzmX8J4TA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AMjHq4g/fSUv/lZuZOljYg my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 35d9ab36..013fd09d 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Builds"); +__PACKAGE__->table("builds"); =head1 ACCESSORS @@ -40,6 +40,7 @@ __PACKAGE__->table("Builds"); data_type: 'integer' is_auto_increment: 1 is_nullable: 0 + sequence: 'builds_id_seq' =head2 finished @@ -200,7 +201,12 @@ __PACKAGE__->table("Builds"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "builds_id_seq", + }, "finished", { data_type => "integer", is_nullable => 0 }, "timestamp", @@ -544,8 +550,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2019-08-19 16:12:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VjYbAQwv4THW2VfWQ5ajYQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H3hs+zEywsUmwTWKfSE8wQ __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/CachedBazaarInputs.pm b/src/lib/Hydra/Schema/CachedBazaarInputs.pm index f3170a9c..6d02c69c 100644 --- a/src/lib/Hydra/Schema/CachedBazaarInputs.pm +++ b/src/lib/Hydra/Schema/CachedBazaarInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedBazaarInputs"); +__PACKAGE__->table("cachedbazaarinputs"); =head1 ACCESSORS @@ -83,8 +83,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zvun8uhxwrr7B8EsqBoCjA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:X8L4C57lMOctdqOKSmfA/g # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/CachedCVSInputs.pm b/src/lib/Hydra/Schema/CachedCVSInputs.pm index 646a9f4f..8f19dd20 100644 --- a/src/lib/Hydra/Schema/CachedCVSInputs.pm +++ b/src/lib/Hydra/Schema/CachedCVSInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedCVSInputs"); +__PACKAGE__->table("cachedcvsinputs"); =head1 ACCESSORS @@ -99,8 +99,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "module", "sha256hash"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vi1qzjW52Lnsl0JSmGzy0w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6eQ+i/th+oVZNRiDPd2luA # You can replace this text with custom content, and it will be preserved on regeneration 1; diff --git a/src/lib/Hydra/Schema/CachedDarcsInputs.pm b/src/lib/Hydra/Schema/CachedDarcsInputs.pm index 59488060..9d218390 100644 --- a/src/lib/Hydra/Schema/CachedDarcsInputs.pm +++ b/src/lib/Hydra/Schema/CachedDarcsInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedDarcsInputs"); +__PACKAGE__->table("cacheddarcsinputs"); =head1 ACCESSORS @@ -90,8 +90,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-09-20 11:08:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Yl1slt3SAizijgu0KUTn0A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Buwq42sBXQVfYUy01WMyYw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/CachedGitInputs.pm b/src/lib/Hydra/Schema/CachedGitInputs.pm index 613ddd88..d85f4970 100644 --- a/src/lib/Hydra/Schema/CachedGitInputs.pm +++ b/src/lib/Hydra/Schema/CachedGitInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedGitInputs"); +__PACKAGE__->table("cachedgitinputs"); =head1 ACCESSORS @@ -92,7 +92,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "branch", "revision"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I4hI02FKRMkw76WV/KBocA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0sdK9uQZpx869oqS5thRLw 1; diff --git a/src/lib/Hydra/Schema/CachedHgInputs.pm b/src/lib/Hydra/Schema/CachedHgInputs.pm index 3cccd818..c1d37091 100644 --- a/src/lib/Hydra/Schema/CachedHgInputs.pm +++ b/src/lib/Hydra/Schema/CachedHgInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedHgInputs"); +__PACKAGE__->table("cachedhginputs"); =head1 ACCESSORS @@ -92,8 +92,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "branch", "revision"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qS/eiiZXmpc7KpTHdtaT7g +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dYfjQ0SJG/mBrsZemAW3zw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/CachedPathInputs.pm b/src/lib/Hydra/Schema/CachedPathInputs.pm index 53716676..1657c7c1 100644 --- a/src/lib/Hydra/Schema/CachedPathInputs.pm +++ b/src/lib/Hydra/Schema/CachedPathInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedPathInputs"); +__PACKAGE__->table("cachedpathinputs"); =head1 ACCESSORS @@ -90,7 +90,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("srcpath", "sha256hash"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:28rja0vR1glJJ15hzVfjsQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oV7tbWLNEMC8byKf9UnAlw 1; diff --git a/src/lib/Hydra/Schema/CachedSubversionInputs.pm b/src/lib/Hydra/Schema/CachedSubversionInputs.pm index 51dc1fa7..bf31de20 100644 --- a/src/lib/Hydra/Schema/CachedSubversionInputs.pm +++ b/src/lib/Hydra/Schema/CachedSubversionInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("CachedSubversionInputs"); +__PACKAGE__->table("cachedsubversioninputs"); =head1 ACCESSORS @@ -83,7 +83,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("uri", "revision"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3qXfnvkOVj25W94bfhQ65w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VGt/0HG84eNZr9OIA8jzow 1; diff --git a/src/lib/Hydra/Schema/FailedPaths.pm b/src/lib/Hydra/Schema/FailedPaths.pm index 082b989d..a3a49733 100644 --- a/src/lib/Hydra/Schema/FailedPaths.pm +++ b/src/lib/Hydra/Schema/FailedPaths.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("FailedPaths"); +__PACKAGE__->table("failedpaths"); =head1 ACCESSORS @@ -57,8 +57,8 @@ __PACKAGE__->add_columns("path", { data_type => "text", is_nullable => 0 }); __PACKAGE__->set_primary_key("path"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2015-06-10 14:48:16 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WFgjfjH+szE6Ntcicmaflw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jr3XiGO4lWAzqfATbsMwFw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Jobs.pm b/src/lib/Hydra/Schema/Jobs.pm index cd89ed3d..bdecef3a 100644 --- a/src/lib/Hydra/Schema/Jobs.pm +++ b/src/lib/Hydra/Schema/Jobs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Jobs"); +__PACKAGE__->table("jobs"); =head1 ACCESSORS @@ -169,7 +169,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:52:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vDAo9bzLca+QWfhOb9OLMg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sYa6dZNK+stMAnTH0Tmn8A 1; diff --git a/src/lib/Hydra/Schema/JobsetEvalInputs.pm b/src/lib/Hydra/Schema/JobsetEvalInputs.pm index e61f0a21..ed39ad45 100644 --- a/src/lib/Hydra/Schema/JobsetEvalInputs.pm +++ b/src/lib/Hydra/Schema/JobsetEvalInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetEvalInputs"); +__PACKAGE__->table("jobsetevalinputs"); =head1 ACCESSORS @@ -166,8 +166,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1Dp8B58leBLh4GK0GPw2zg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/cFQGBLhvpmBO1UJztgIAg my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/JobsetEvalMembers.pm b/src/lib/Hydra/Schema/JobsetEvalMembers.pm index 5f41e432..9448a203 100644 --- a/src/lib/Hydra/Schema/JobsetEvalMembers.pm +++ b/src/lib/Hydra/Schema/JobsetEvalMembers.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetEvalMembers"); +__PACKAGE__->table("jobsetevalmembers"); =head1 ACCESSORS @@ -110,8 +110,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ccPNQe/QnSjTAC3uGWe8Ng +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T+dJFh/sDO8WsasqYVLRSQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/JobsetEvals.pm b/src/lib/Hydra/Schema/JobsetEvals.pm index 0bd21da2..5558b39a 100644 --- a/src/lib/Hydra/Schema/JobsetEvals.pm +++ b/src/lib/Hydra/Schema/JobsetEvals.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetEvals"); +__PACKAGE__->table("jobsetevals"); =head1 ACCESSORS @@ -40,6 +40,7 @@ __PACKAGE__->table("JobsetEvals"); data_type: 'integer' is_auto_increment: 1 is_nullable: 0 + sequence: 'jobsetevals_id_seq' =head2 project @@ -92,7 +93,12 @@ __PACKAGE__->table("JobsetEvals"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "jobsetevals_id_seq", + }, "project", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "jobset", @@ -188,8 +194,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SlEiF8oN6FBK262uSiMKiw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4ZaT8Z1tmCCt6k4ein0MNg __PACKAGE__->has_many( "buildIds", diff --git a/src/lib/Hydra/Schema/JobsetInputAlts.pm b/src/lib/Hydra/Schema/JobsetInputAlts.pm index 3802d9f1..e8f030b3 100644 --- a/src/lib/Hydra/Schema/JobsetInputAlts.pm +++ b/src/lib/Hydra/Schema/JobsetInputAlts.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetInputAlts"); +__PACKAGE__->table("jobsetinputalts"); =head1 ACCESSORS @@ -121,7 +121,7 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UUO37lIuEYm0GiR92m/fyA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nh8dQDL9FtgzXcwjDufDMQ 1; diff --git a/src/lib/Hydra/Schema/JobsetInputs.pm b/src/lib/Hydra/Schema/JobsetInputs.pm index b67a3519..d0964ab4 100644 --- a/src/lib/Hydra/Schema/JobsetInputs.pm +++ b/src/lib/Hydra/Schema/JobsetInputs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetInputs"); +__PACKAGE__->table("jobsetinputs"); =head1 ACCESSORS @@ -130,28 +130,9 @@ __PACKAGE__->has_many( undef, ); -=head2 jobsets -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "jobsets", - "Hydra::Schema::Jobsets", - { - "foreign.name" => "self.jobset", - "foreign.nixexprinput" => "self.name", - "foreign.project" => "self.project", - }, - undef, -); - - -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-08 13:06:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+mZZqLjQNwblb/EWW1alLQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5uKwEhDXso4IR1TFmwRxiA my %hint = ( relations => { diff --git a/src/lib/Hydra/Schema/JobsetRenames.pm b/src/lib/Hydra/Schema/JobsetRenames.pm index 874e7a24..794d6e16 100644 --- a/src/lib/Hydra/Schema/JobsetRenames.pm +++ b/src/lib/Hydra/Schema/JobsetRenames.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("JobsetRenames"); +__PACKAGE__->table("jobsetrenames"); =head1 ACCESSORS @@ -110,8 +110,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 23:13:51 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SBpKWF9swFc9T1Uc0VFlgA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eOQbJ2O/p0G1317m3IC/KA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 17b4ab93..a69bd599 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -27,18 +27,17 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Jobsets"); +__PACKAGE__->table("jobsets"); =head1 ACCESSORS =head2 name data_type: 'text' - is_foreign_key: 1 is_nullable: 0 =head2 project @@ -55,7 +54,6 @@ __PACKAGE__->table("Jobsets"); =head2 nixexprinput data_type: 'text' - is_foreign_key: 1 is_nullable: 0 =head2 nixexprpath @@ -143,13 +141,13 @@ __PACKAGE__->table("Jobsets"); __PACKAGE__->add_columns( "name", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, + { data_type => "text", is_nullable => 0 }, "project", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "description", { data_type => "text", is_nullable => 1 }, "nixexprinput", - { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, + { data_type => "text", is_nullable => 0 }, "nixexprpath", { data_type => "text", is_nullable => 0 }, "errormsg", @@ -270,21 +268,6 @@ __PACKAGE__->has_many( undef, ); -=head2 jobsetinput - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "jobsetinput", - "Hydra::Schema::JobsetInputs", - { jobset => "name", name => "nixexprinput", project => "project" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, -); - =head2 jobsetinputs Type: has_many @@ -352,8 +335,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2017-03-09 13:03:05 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ivYvsUyhEeaeI4EmRQ0/QQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fYKx6VRlNG5XiDZ73Qr6Rw my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/NewsItems.pm b/src/lib/Hydra/Schema/NewsItems.pm index 14d27428..0bd3f04b 100644 --- a/src/lib/Hydra/Schema/NewsItems.pm +++ b/src/lib/Hydra/Schema/NewsItems.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("NewsItems"); +__PACKAGE__->table("newsitems"); =head1 ACCESSORS @@ -40,6 +40,7 @@ __PACKAGE__->table("NewsItems"); data_type: 'integer' is_auto_increment: 1 is_nullable: 0 + sequence: 'newsitems_id_seq' =head2 contents @@ -61,7 +62,12 @@ __PACKAGE__->table("NewsItems"); __PACKAGE__->add_columns( "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "newsitems_id_seq", + }, "contents", { data_type => "text", is_nullable => 0 }, "createtime", @@ -100,7 +106,7 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3CRNsvd+YnZp9c80tuZREQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:r6vX8VG/+NQraIVKFgHzxQ 1; diff --git a/src/lib/Hydra/Schema/NrBuilds.pm b/src/lib/Hydra/Schema/NrBuilds.pm index 27ae2e83..7e6601b2 100644 --- a/src/lib/Hydra/Schema/NrBuilds.pm +++ b/src/lib/Hydra/Schema/NrBuilds.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("NrBuilds"); +__PACKAGE__->table("nrbuilds"); =head1 ACCESSORS @@ -67,8 +67,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("what"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-08-12 17:59:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CK8eJGC803nGj0wnete9xg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qv1I8Wu7KXHAs+pyBn2ofA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/ProjectMembers.pm b/src/lib/Hydra/Schema/ProjectMembers.pm index 62b1c542..78f02875 100644 --- a/src/lib/Hydra/Schema/ProjectMembers.pm +++ b/src/lib/Hydra/Schema/ProjectMembers.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("ProjectMembers"); +__PACKAGE__->table("projectmembers"); =head1 ACCESSORS @@ -103,8 +103,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:imPoiaitrTbX0vVNlF6dPA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:e/hYmoNmcEUoGhRqtwdyQw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/Projects.pm b/src/lib/Hydra/Schema/Projects.pm index 11405561..038ccdc7 100644 --- a/src/lib/Hydra/Schema/Projects.pm +++ b/src/lib/Hydra/Schema/Projects.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Projects"); +__PACKAGE__->table("projects"); =head1 ACCESSORS @@ -303,8 +303,8 @@ Composing rels: L -> username __PACKAGE__->many_to_many("usernames", "projectmembers", "username"); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2016-03-11 10:39:17 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1ats3brIVhRTWLToIYSoaQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pcF/8351zyo9VL6N5eimdQ my %hint = ( columns => [ diff --git a/src/lib/Hydra/Schema/ReleaseMembers.pm b/src/lib/Hydra/Schema/ReleaseMembers.pm index b3b0975b..6c6e8a0e 100644 --- a/src/lib/Hydra/Schema/ReleaseMembers.pm +++ b/src/lib/Hydra/Schema/ReleaseMembers.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("ReleaseMembers"); +__PACKAGE__->table("releasemembers"); =head1 ACCESSORS @@ -135,7 +135,7 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7M7WPlGQT6rNHKJ+82/KSA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k4z2YeB4gRAeAP6hmR93sQ 1; diff --git a/src/lib/Hydra/Schema/Releases.pm b/src/lib/Hydra/Schema/Releases.pm index 8ff01bde..8cfb19e1 100644 --- a/src/lib/Hydra/Schema/Releases.pm +++ b/src/lib/Hydra/Schema/Releases.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Releases"); +__PACKAGE__->table("releases"); =head1 ACCESSORS @@ -119,7 +119,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qISBiwvboB8dIdinaE45mg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b4M/tHOhsy234tgTf+wqjQ 1; diff --git a/src/lib/Hydra/Schema/SchemaVersion.pm b/src/lib/Hydra/Schema/SchemaVersion.pm index 8a826e38..4165de9d 100644 --- a/src/lib/Hydra/Schema/SchemaVersion.pm +++ b/src/lib/Hydra/Schema/SchemaVersion.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("SchemaVersion"); +__PACKAGE__->table("schemaversion"); =head1 ACCESSORS @@ -45,8 +45,8 @@ __PACKAGE__->table("SchemaVersion"); __PACKAGE__->add_columns("version", { data_type => "integer", is_nullable => 0 }); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:08/7gbEQp1TqBiWFJXVY0w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2wy4FsRYVVo2RTCWXcmgvg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/StarredJobs.pm b/src/lib/Hydra/Schema/StarredJobs.pm index 51bde91f..4114d65f 100644 --- a/src/lib/Hydra/Schema/StarredJobs.pm +++ b/src/lib/Hydra/Schema/StarredJobs.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("StarredJobs"); +__PACKAGE__->table("starredjobs"); =head1 ACCESSORS @@ -153,8 +153,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:naj5aKWuw8hLE6klmvW9Eg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fw4FfzmOhzDk0ZoSuNr2ww # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/SystemStatus.pm b/src/lib/Hydra/Schema/SystemStatus.pm index 7c99e780..6b794fed 100644 --- a/src/lib/Hydra/Schema/SystemStatus.pm +++ b/src/lib/Hydra/Schema/SystemStatus.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("SystemStatus"); +__PACKAGE__->table("systemstatus"); =head1 ACCESSORS @@ -67,8 +67,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("what"); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:01:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JCYi4+HwM22iucdFkhBjMg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GeXpTVktMXjHENa/P3qOxw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/SystemTypes.pm b/src/lib/Hydra/Schema/SystemTypes.pm index 0d68d467..f9efd973 100644 --- a/src/lib/Hydra/Schema/SystemTypes.pm +++ b/src/lib/Hydra/Schema/SystemTypes.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("SystemTypes"); +__PACKAGE__->table("systemtypes"); =head1 ACCESSORS @@ -68,7 +68,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("system"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8cC34cEw9T3+x+7uRs4KHQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fYeKQQSS5J8rjO3t+Hbz0g 1; diff --git a/src/lib/Hydra/Schema/UriRevMapper.pm b/src/lib/Hydra/Schema/UriRevMapper.pm index 448015af..cd9d8567 100644 --- a/src/lib/Hydra/Schema/UriRevMapper.pm +++ b/src/lib/Hydra/Schema/UriRevMapper.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("UriRevMapper"); +__PACKAGE__->table("urirevmapper"); =head1 ACCESSORS @@ -67,8 +67,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("baseuri"); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:G2GAF/Rb7cRkRegH94LwIA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FOg2/BVJK3yg8MAYMrqZOQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/src/lib/Hydra/Schema/UserRoles.pm b/src/lib/Hydra/Schema/UserRoles.pm index 2644da7a..a7ce5ed9 100644 --- a/src/lib/Hydra/Schema/UserRoles.pm +++ b/src/lib/Hydra/Schema/UserRoles.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("UserRoles"); +__PACKAGE__->table("userroles"); =head1 ACCESSORS @@ -87,7 +87,7 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aS+ivlFpndqIv8U578zz9A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LUw2PDFvUHs0E0UZ3oHFxw 1; diff --git a/src/lib/Hydra/Schema/Users.pm b/src/lib/Hydra/Schema/Users.pm index 43842fb9..7789b42c 100644 --- a/src/lib/Hydra/Schema/Users.pm +++ b/src/lib/Hydra/Schema/Users.pm @@ -27,11 +27,11 @@ use base 'DBIx::Class::Core'; __PACKAGE__->load_components("+Hydra::Component::ToJSON"); -=head1 TABLE: C +=head1 TABLE: C =cut -__PACKAGE__->table("Users"); +__PACKAGE__->table("users"); =head1 ACCESSORS @@ -192,8 +192,8 @@ Composing rels: L -> project __PACKAGE__->many_to_many("projects", "projectmembers", "project"); -# Created by DBIx::Class::Schema::Loader v0.07043 @ 2016-05-27 11:32:14 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Az1+V+ztJoWUt50NLQR3xg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4/WZ95asbnGmK+nEHb4sLQ my %hint = ( columns => [ diff --git a/src/sql/Makefile.am b/src/sql/Makefile.am index 85613a5b..cd4bfb9b 100644 --- a/src/sql/Makefile.am +++ b/src/sql/Makefile.am @@ -2,7 +2,6 @@ sqldir = $(libexecdir)/hydra/sql nobase_dist_sql_DATA = \ hydra-postgresql.sql \ hydra.sql \ - hydra-sqlite.sql \ test.sql \ upgrade-*.sql \ update-dbix.pl @@ -10,10 +9,5 @@ nobase_dist_sql_DATA = \ hydra-postgresql.sql: hydra.sql cpp -P -E -traditional-cpp -DPOSTGRESQL hydra.sql > $@ || rm -f $@ -hydra-sqlite.sql: hydra.sql - cpp -P -E -traditional-cpp -DSQLITE hydra.sql > $@ || rm -f $@ - -update-dbix: hydra-sqlite.sql - rm -f tmp.sqlite - sqlite3 tmp.sqlite < hydra-sqlite.sql - perl -I ../lib -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:../lib update-dbix.pl +update-dbix: hydra-postgresql.sql + ./update-dbix-harness.sh diff --git a/src/sql/update-dbix-harness.sh b/src/sql/update-dbix-harness.sh new file mode 100755 index 00000000..d76e9e91 --- /dev/null +++ b/src/sql/update-dbix-harness.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +readonly scratch=$(mktemp -d -t tmp.XXXXXXXXXX) + +readonly socket=$scratch/socket +readonly data=$scratch/data +readonly dbname=hydra-update-dbix + +function finish { + set +e + pg_ctl -D "$data" \ + -o "-F -h '' -k \"$socket\"" \ + -w stop -m immediate + + if [ -f "$data/postmaster.pid" ]; then + pg_ctl -D "$data" \ + -o "-F -h '' -k \"$socket\"" \ + -w kill TERM "$(cat "$data/postmaster.pid")" + fi + + rm -rf "$scratch" +} +trap finish EXIT + +set -e + +mkdir -p "$socket" +initdb -D "$data" + +pg_ctl -D "$data" \ + -o "-F -h '' -k \"${socket}\"" \ + -w start + +createdb -h "$socket" "$dbname" + +psql -h "$socket" "$dbname" -f ./hydra-postgresql.sql + +perl -I ../lib \ + -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:../lib \ + update-dbix.pl "dbi:Pg:dbname=$dbname;host=$socket" diff --git a/src/sql/update-dbix.pl b/src/sql/update-dbix.pl index 9089617a..5dc2912d 100644 --- a/src/sql/update-dbix.pl +++ b/src/sql/update-dbix.pl @@ -1,8 +1,49 @@ +use Cwd; + +die "$0: dbi connection string required \n" if scalar @ARGV != 1; + make_schema_at("Hydra::Schema", { naming => { ALL => "v5" }, relationships => 1, - moniker_map => sub { return "$_"; }, + moniker_map => { + "aggregateconstituents" => "AggregateConstituents", + "buildinputs" => "BuildInputs", + "buildmetrics" => "BuildMetrics", + "buildoutputs" => "BuildOutputs", + "buildproducts" => "BuildProducts", + "builds" => "Builds", + "buildstepoutputs" => "BuildStepOutputs", + "buildsteps" => "BuildSteps", + "cachedbazaarinputs" => "CachedBazaarInputs", + "cachedcvsinputs" => "CachedCVSInputs", + "cacheddarcsinputs" => "CachedDarcsInputs", + "cachedgitinputs" => "CachedGitInputs", + "cachedhginputs" => "CachedHgInputs", + "cachedpathinputs" => "CachedPathInputs", + "cachedsubversioninputs" => "CachedSubversionInputs", + "failedpaths" => "FailedPaths", + "jobs" => "Jobs", + "jobsetevalinputs" => "JobsetEvalInputs", + "jobsetevalmembers" => "JobsetEvalMembers", + "jobsetevals" => "JobsetEvals", + "jobsetinputalts" => "JobsetInputAlts", + "jobsetinputs" => "JobsetInputs", + "jobsetrenames" => "JobsetRenames", + "jobsets" => "Jobsets", + "newsitems" => "NewsItems", + "nrbuilds" => "NrBuilds", + "projectmembers" => "ProjectMembers", + "projects" => "Projects", + "releasemembers" => "ReleaseMembers", + "releases" => "Releases", + "schemaversion" => "SchemaVersion", + "starredjobs" => "StarredJobs", + "systemstatus" => "SystemStatus", + "systemtypes" => "SystemTypes", + "urirevmapper" => "UriRevMapper", + "userroles" => "UserRoles", + "users" => "Users", + } , #sub { return "$_"; }, components => [ "+Hydra::Component::ToJSON" ], rel_name_map => { buildsteps_builds => "buildsteps" } -}, ["dbi:SQLite:tmp.sqlite"]); - +}, [$ARGV[0]]); From 6fe57ab5fad9f2728f9d6de6b296fe8187a6bd72 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 9 Feb 2020 15:17:24 -0500 Subject: [PATCH 2/9] Copy the flake migration from the flake branch hydra.nixos.org is already running this rev, and it should be safe to apply to everyone else. If we make changes to this migration, we'll need to write another migration anyway. --- src/lib/Hydra/Schema/JobsetEvals.pm | 11 +++++++++-- src/lib/Hydra/Schema/Jobsets.pm | 27 +++++++++++++++++++++------ src/sql/hydra.sql | 13 ++++++++++--- src/sql/upgrade-58.sql | 7 +++++++ 4 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 src/sql/upgrade-58.sql diff --git a/src/lib/Hydra/Schema/JobsetEvals.pm b/src/lib/Hydra/Schema/JobsetEvals.pm index 5558b39a..7e88c25e 100644 --- a/src/lib/Hydra/Schema/JobsetEvals.pm +++ b/src/lib/Hydra/Schema/JobsetEvals.pm @@ -89,6 +89,11 @@ __PACKAGE__->table("jobsetevals"); data_type: 'integer' is_nullable: 1 +=head2 flake + + data_type: 'text' + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -117,6 +122,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 1 }, "nrsucceeded", { data_type => "integer", is_nullable => 1 }, + "flake", + { data_type => "text", is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -194,8 +201,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4ZaT8Z1tmCCt6k4ein0MNg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:21:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ar6GRni8AcAQmuZyg6tFKw __PACKAGE__->has_many( "buildIds", diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index a69bd599..9e9d4773 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -54,12 +54,12 @@ __PACKAGE__->table("jobsets"); =head2 nixexprinput data_type: 'text' - is_nullable: 0 + is_nullable: 1 =head2 nixexprpath data_type: 'text' - is_nullable: 0 + is_nullable: 1 =head2 errormsg @@ -137,6 +137,17 @@ __PACKAGE__->table("jobsets"); data_type: 'integer' is_nullable: 1 +=head2 type + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=head2 flake + + data_type: 'text' + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -147,9 +158,9 @@ __PACKAGE__->add_columns( "description", { data_type => "text", is_nullable => 1 }, "nixexprinput", - { data_type => "text", is_nullable => 0 }, + { data_type => "text", is_nullable => 1 }, "nixexprpath", - { data_type => "text", is_nullable => 0 }, + { data_type => "text", is_nullable => 1 }, "errormsg", { data_type => "text", is_nullable => 1 }, "errortime", @@ -178,6 +189,10 @@ __PACKAGE__->add_columns( { data_type => "boolean", is_nullable => 1 }, "starttime", { data_type => "integer", is_nullable => 1 }, + "type", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "flake", + { data_type => "text", is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -335,8 +350,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fYKx6VRlNG5XiDZ73Qr6Rw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:21:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FVP1/AWjdKTlY6djrG592A my %hint = ( columns => [ diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 0c769a7e..33ecab4d 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -54,8 +54,8 @@ create table Jobsets ( name text not null, project text not null, description text, - nixExprInput text not null, -- name of the jobsetInput containing the Nix or Guix expression - nixExprPath text not null, -- relative path of the Nix or Guix expression + nixExprInput text, -- name of the jobsetInput containing the Nix or Guix expression + nixExprPath text, -- relative path of the Nix or Guix expression errorMsg text, -- used to signal the last evaluation error etc. for this jobset errorTime integer, -- timestamp associated with errorMsg lastCheckedTime integer, -- last time the evaluator looked at this jobset @@ -70,7 +70,11 @@ create table Jobsets ( fetchErrorMsg text, forceEval boolean, startTime integer, -- if jobset is currently running + type integer not null default 0, -- 0 == legacy, 1 == flake + flake text, check (schedulingShares > 0), + check ((type = 0) = (nixExprInput is not null and nixExprPath is not null)), + check ((type = 1) = (flake is not null)), primary key (project, name), foreign key (project) references Projects(name) on delete cascade on update cascade #ifdef SQLITE @@ -181,7 +185,8 @@ create table Builds ( -- Copy of the nixExprInput/nixExprPath fields of the jobset that -- instantiated this build. Needed if we want to reproduce this - -- build. + -- build. FIXME: this should be stored in JobsetEvals, storing it + -- here is denormal. nixExprInput text, nixExprPath text, @@ -522,6 +527,8 @@ create table JobsetEvals ( nrBuilds integer, nrSucceeded integer, -- set lazily when all builds are finished + flake text, -- immutable flake reference + foreign key (project) references Projects(name) on delete cascade on update cascade, foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade ); diff --git a/src/sql/upgrade-58.sql b/src/sql/upgrade-58.sql new file mode 100644 index 00000000..b59ee949 --- /dev/null +++ b/src/sql/upgrade-58.sql @@ -0,0 +1,7 @@ +alter table Jobsets alter column nixExprInput drop not null; +alter table Jobsets alter column nixExprPath drop not null; +alter table Jobsets add column type integer default 0; +alter table Jobsets add column flake text; +alter table Jobsets add check ((type = 0) = (nixExprInput is not null and nixExprPath is not null)); +alter table Jobsets add check ((type = 1) = (flake is not null)); +alter table JobsetEvals add column flake text; From e00030563b092361eac2c4571a3e86453566b28f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 14:06:21 -0500 Subject: [PATCH 3/9] Jobsets: add a SERIAL, unique, non-null id column A postgresql column which is non-null and unique is treated with the same optimisations as a primary key, so we have no need to try and recreate the `id` as the primary key. No read paths are impacted by this change, and the database will automatically create an ID for each insert. Thus, no code needs to change. --- src/lib/Hydra/Schema/Jobsets.pm | 36 +++++++++++++++++++++++++++++++-- src/sql/hydra.sql | 4 +++- src/sql/upgrade-59.sql | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 src/sql/upgrade-59.sql diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 9e9d4773..2615ef87 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -40,6 +40,13 @@ __PACKAGE__->table("jobsets"); data_type: 'text' is_nullable: 0 +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'jobsets_id_seq' + =head2 project data_type: 'text' @@ -153,6 +160,13 @@ __PACKAGE__->table("jobsets"); __PACKAGE__->add_columns( "name", { data_type => "text", is_nullable => 0 }, + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "jobsets_id_seq", + }, "project", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "description", @@ -209,6 +223,20 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("project", "name"); +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("jobsets_id_unique", ["id"]); + =head1 RELATIONS =head2 buildmetrics @@ -350,8 +378,12 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:21:11 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FVP1/AWjdKTlY6djrG592A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:25:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1CMOaLf9fYRdJBlYiivmxA + +__PACKAGE__->add_column( + "+id" => { retrieve_on_insert => 1 } +); my %hint = ( columns => [ diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 33ecab4d..6b22121c 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -52,6 +52,7 @@ create table ProjectMembers ( -- describing build jobs. create table Jobsets ( name text not null, + id serial not null, project text not null, description text, nixExprInput text, -- name of the jobsetInput containing the Nix or Guix expression @@ -76,7 +77,8 @@ create table Jobsets ( check ((type = 0) = (nixExprInput is not null and nixExprPath is not null)), check ((type = 1) = (flake is not null)), primary key (project, name), - foreign key (project) references Projects(name) on delete cascade on update cascade + foreign key (project) references Projects(name) on delete cascade on update cascade, + constraint Jobsets_id_unique UNIQUE(id) #ifdef SQLITE , foreign key (project, name, nixExprInput) references JobsetInputs(project, jobset, name) diff --git a/src/sql/upgrade-59.sql b/src/sql/upgrade-59.sql new file mode 100644 index 00000000..d0a28971 --- /dev/null +++ b/src/sql/upgrade-59.sql @@ -0,0 +1,4 @@ +-- will automatically add unique IDs to Jobsets. +ALTER TABLE Jobsets + ADD COLUMN id SERIAL NOT NULL, + ADD CONSTRAINT Jobsets_id_unique UNIQUE (id); From efa1f1d4fbdc468c61f7403e8709d0295e052c7f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 17:10:50 -0500 Subject: [PATCH 4/9] Jobs: add a nullable jobset_id foreign key to Jobsets. Also, adds an explicitly named "jobs" accessor to the Jobsets Schema object, which uses the project/jobset name. --- src/lib/Hydra/Schema/Jobs.pm | 32 +++++++++++++++++++++++-- src/lib/Hydra/Schema/Jobsets.pm | 41 +++++++++++++++++++++++++++++---- src/sql/hydra.sql | 2 ++ src/sql/upgrade-60.sql | 10 ++++++++ 4 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 src/sql/upgrade-60.sql diff --git a/src/lib/Hydra/Schema/Jobs.pm b/src/lib/Hydra/Schema/Jobs.pm index bdecef3a..d4126e32 100644 --- a/src/lib/Hydra/Schema/Jobs.pm +++ b/src/lib/Hydra/Schema/Jobs.pm @@ -47,6 +47,12 @@ __PACKAGE__->table("jobs"); is_foreign_key: 1 is_nullable: 0 +=head2 jobset_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + =head2 name data_type: 'text' @@ -59,6 +65,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "jobset", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, + "jobset_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "name", { data_type => "text", is_nullable => 0 }, ); @@ -130,6 +138,26 @@ Related object: L __PACKAGE__->belongs_to( "jobset", "Hydra::Schema::Jobsets", + { id => "jobset_id" }, + { + is_deferrable => 0, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "NO ACTION", + }, +); + +=head2 jobset_project_jobset + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "jobset_project_jobset", + "Hydra::Schema::Jobsets", { name => "jobset", project => "project" }, { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, ); @@ -169,7 +197,7 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sYa6dZNK+stMAnTH0Tmn8A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:30:58 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dFusVjxb423gIEoadAw9sw 1; diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 2615ef87..60efa962 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -275,7 +275,7 @@ __PACKAGE__->has_many( undef, ); -=head2 jobs +=head2 jobs_jobset_ids Type: has_many @@ -284,7 +284,22 @@ Related object: L =cut __PACKAGE__->has_many( - "jobs", + "jobs_jobset_ids", + "Hydra::Schema::Jobs", + { "foreign.jobset_id" => "self.id" }, + undef, +); + +=head2 jobs_project_jobsets + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "jobs_project_jobsets", "Hydra::Schema::Jobs", { "foreign.jobset" => "self.name", @@ -378,8 +393,26 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:25:17 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1CMOaLf9fYRdJBlYiivmxA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:26:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DH1jX0smo2rFvyr4V+qJcw + +=head2 jobs + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "jobs", + "Hydra::Schema::Jobs", + { + "foreign.jobset" => "self.name", + "foreign.project" => "self.project", + }, + undef, +); __PACKAGE__->add_column( "+id" => { retrieve_on_insert => 1 } diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 6b22121c..77b5822a 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -146,9 +146,11 @@ create table JobsetInputAlts ( create table Jobs ( project text not null, jobset text not null, + jobset_id integer null, name text not null, primary key (project, jobset, name), + foreign key (jobset_id) references Jobsets(id) on delete cascade, foreign key (project) references Projects(name) on delete cascade on update cascade, foreign key (project, jobset) references Jobsets(project, name) on delete cascade on update cascade ); diff --git a/src/sql/upgrade-60.sql b/src/sql/upgrade-60.sql new file mode 100644 index 00000000..3cdb00c3 --- /dev/null +++ b/src/sql/upgrade-60.sql @@ -0,0 +1,10 @@ +-- Add the jobset_id columns to the Jobs 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 Jobs + ADD COLUMN jobset_id integer NULL, + ADD FOREIGN KEY (jobset_id) + REFERENCES Jobsets(id) + ON DELETE CASCADE; From 624f1d8d2d3641694acef83367a5c557cfe9bfde Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 17:30:11 -0500 Subject: [PATCH 5/9] Jobs: populate Jobs.jobset_id field when writing from hydra-eval-jobset --- src/script/hydra-eval-jobset | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index fcc60a6c..5e68f124 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -417,7 +417,12 @@ sub checkBuild { my $build; txn_do($db, sub { - my $job = $jobset->jobs->update_or_create({ name => $jobName }); + my $job = $jobset->jobs->update_or_create({ + name => $jobName, + jobset_id => $jobset->id, + project => $jobset->project, + jobset => $jobset->name, + }); # Don't add a build that has already been scheduled for this # job, or has been built but is still a "current" build for From ddf00fa6278532c9cce6bfeceeb1ee3d9c3e45cd Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 15:11:56 -0500 Subject: [PATCH 6/9] 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. --- src/lib/Hydra/Schema/Builds.pm | 32 +++++++++++++++++++++++-- src/lib/Hydra/Schema/Jobsets.pm | 42 +++++++++++++++++++++++++++++---- src/sql/hydra.sql | 2 ++ src/sql/upgrade-61.sql | 10 ++++++++ 4 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 src/sql/upgrade-61.sql diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 013fd09d..53454867 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -64,6 +64,12 @@ __PACKAGE__->table("builds"); is_foreign_key: 1 is_nullable: 0 +=head2 jobset_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + =head2 job data_type: 'text' @@ -215,6 +221,8 @@ __PACKAGE__->add_columns( { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "jobset", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, + "jobset_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "job", { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, "nixname", @@ -457,6 +465,26 @@ Related object: L __PACKAGE__->belongs_to( "jobset", "Hydra::Schema::Jobsets", + { id => "jobset_id" }, + { + is_deferrable => 0, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "NO ACTION", + }, +); + +=head2 jobset_project_jobset + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "jobset_project_jobset", + "Hydra::Schema::Jobsets", { name => "jobset", project => "project" }, { is_deferrable => 0, on_delete => "NO ACTION", on_update => "CASCADE" }, ); @@ -550,8 +578,8 @@ __PACKAGE__->many_to_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:22:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H3hs+zEywsUmwTWKfSE8wQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-06 12:32:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RvrINOAowDcde8Nd9VD6rQ __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/Jobsets.pm b/src/lib/Hydra/Schema/Jobsets.pm index 60efa962..fbbb253c 100644 --- a/src/lib/Hydra/Schema/Jobsets.pm +++ b/src/lib/Hydra/Schema/Jobsets.pm @@ -257,7 +257,7 @@ __PACKAGE__->has_many( undef, ); -=head2 builds +=head2 builds_jobset_ids Type: has_many @@ -266,7 +266,22 @@ Related object: L =cut __PACKAGE__->has_many( - "builds", + "builds_jobset_ids", + "Hydra::Schema::Builds", + { "foreign.jobset_id" => "self.id" }, + undef, +); + +=head2 builds_project_jobsets + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "builds_project_jobsets", "Hydra::Schema::Builds", { "foreign.jobset" => "self.name", @@ -393,8 +408,27 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:26:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DH1jX0smo2rFvyr4V+qJcw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-02-09 15:32:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:P8+t7rgpOqkGwRdM2b+3Bw + + +=head2 builds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "builds", + "Hydra::Schema::Builds", + { + "foreign.jobset" => "self.name", + "foreign.project" => "self.project", + }, + undef, +); =head2 jobs diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 77b5822a..8349e3be 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -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 diff --git a/src/sql/upgrade-61.sql b/src/sql/upgrade-61.sql new file mode 100644 index 00000000..bfa6b8b3 --- /dev/null +++ b/src/sql/upgrade-61.sql @@ -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; From f3a561aecd4469e456bd214f4f3f6648ce46d916 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 16:24:43 -0500 Subject: [PATCH 7/9] Builds: populate Builds.jobset_id in hydra-eval-jobset --- src/script/hydra-eval-jobset | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/script/hydra-eval-jobset b/src/script/hydra-eval-jobset index 5e68f124..d0cc3e8a 100755 --- a/src/script/hydra-eval-jobset +++ b/src/script/hydra-eval-jobset @@ -469,6 +469,9 @@ sub checkBuild { # Add the build to the database. $build = $job->builds->create( { timestamp => $time + , project => $jobset->project + , jobset => $jobset->name + , jobset_id => $jobset->id , description => null($buildInfo->{description}) , license => null($buildInfo->{license}) , homepage => null($buildInfo->{homepage}) From f69260118bf7e78a4b7830ea58e2f0ba8c85d6b7 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 5 Feb 2020 21:12:49 -0500 Subject: [PATCH 8/9] hydra-backfill-ids: create to add jobset_id values to Builds and Jobs Vacuum every 10 iterations, update 10k at a time. --- src/script/Makefile.am | 1 + src/script/hydra-backfill-ids | 164 ++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100755 src/script/hydra-backfill-ids diff --git a/src/script/Makefile.am b/src/script/Makefile.am index 5852bc85..9deb6f29 100644 --- a/src/script/Makefile.am +++ b/src/script/Makefile.am @@ -3,6 +3,7 @@ EXTRA_DIST = \ hydra-eval-guile-jobs.in distributable_scripts = \ + hydra-backfill-ids \ hydra-init \ hydra-eval-jobset \ hydra-server \ diff --git a/src/script/hydra-backfill-ids b/src/script/hydra-backfill-ids new file mode 100755 index 00000000..d9fc362a --- /dev/null +++ b/src/script/hydra-backfill-ids @@ -0,0 +1,164 @@ +#! /usr/bin/env perl + +use strict; +use utf8; +use Hydra::Model::DB; + +STDOUT->autoflush(); +STDERR->autoflush(1); +binmode STDERR, ":encoding(utf8)"; + +my $db = Hydra::Model::DB->new(); +my $vacuum = $db->storage->dbh->prepare("VACUUM;"); + +my $dryRun = defined $ENV{'HYDRA_DRY_RUN'}; + +my $batchSize = 10000; +my $iterationsPerVacuum = 500; + +sub backfillJobsJobsetId { + my ($skipLocked) = @_; + my $logPrefix; + + if ($skipLocked) { + $logPrefix = "(pass 1/2)"; + } else { + $logPrefix = "(pass 2/2)"; + } + + print STDERR "$logPrefix Backfilling Jobs records where jobset_id is NULL...\n"; + + my $totalToGoSth = $db->storage->dbh->prepare(<execute(); + my ($totalToGo) = $totalToGoSth->fetchrow_array; + + my $skipLockedStmt = $skipLocked ? "FOR UPDATE SKIP LOCKED" : ""; + my $update10kJobs = $db->storage->dbh->prepare(<execute($batchSize); + print STDERR "$logPrefix (batch #$iteration; $totalToGo remaining) Jobs.jobset_id: affected $affected rows...\n"; + $totalToGo -= $affected; + + if ($iteration % $iterationsPerVacuum == 0) { + print STDERR "$logPrefix (batch #$iteration) Vacuuming...\n"; + $vacuum->execute(); + } + } while ($affected > 0); + + + if ($skipLocked) { + backfillJobsJobsetId(0); + } +} + + +sub backfillBuildsJobsetId { + my ($skipLocked) = @_; + my $logPrefix; + + if ($skipLocked) { + $logPrefix = "(pass 1/2)"; + print STDERR "$logPrefix Backfilling unlocked Builds records where jobset_id is NULL...\n"; + } else { + $logPrefix = "(pass 2/2)"; + print STDERR "$logPrefix Backfilling all Builds records where jobset_id is NULL...\n"; + } + + my $skipLockedStmt = $skipLocked ? "FOR UPDATE SKIP LOCKED" : ""; + my $update10kBuilds = $db->storage->dbh->prepare(<<"QUERY"); +WITH updateprogress AS ( + UPDATE builds + SET jobset_id = ( + SELECT jobsets.id + FROM jobsets + WHERE jobsets.name = builds.jobset + AND jobsets.project = builds.project + ) + WHERE builds.id in ( + SELECT buildprime.id + FROM builds buildprime + WHERE buildprime.jobset_id IS NULL + AND buildprime.id >= ? + ORDER BY buildprime.id + $skipLockedStmt + LIMIT ? + ) + RETURNING id +) +SELECT + count(*) AS affected, + max(updateprogress.id) AS highest_id +FROM updateprogress; + +QUERY + + my $lowestNullIdSth = $db->storage->dbh->prepare(<execute(); + my ($highestId) = $lowestNullIdSth->fetchrow_array; + + my $totalToGoSth = $db->storage->dbh->prepare(<= ? +QUERY + $totalToGoSth->execute($highestId); + my ($totalToGo) = $totalToGoSth->fetchrow_array; + + print STDERR "$logPrefix Total Builds records without a jobset_id: $totalToGo, starting at $highestId\n"; + + my $iteration = 0; + my $affected; + do { + my $previousHighId = $highestId; + $iteration++; + $update10kBuilds->execute($highestId, $batchSize); + ($affected, $highestId) = $update10kBuilds->fetchrow_array; + + print STDERR "$logPrefix (batch #$iteration; $totalToGo remaining) Builds.jobset_id: affected $affected rows; max ID: $previousHighId -> $highestId\n"; + $totalToGo -= $affected; + + if ($iteration % $iterationsPerVacuum == 0) { + print STDERR "$logPrefix (batch #$iteration) Vacuuming...\n"; + $vacuum->execute(); + } + } while ($affected > 0); + + if ($skipLocked) { + backfillBuildsJobsetId(0); + } +} + +die "syntax: $0\n" unless @ARGV == 0; + +print STDERR "Beginning with a VACUUM\n"; +$vacuum->execute(); + +backfillJobsJobsetId(1); +backfillBuildsJobsetId(1); + +print STDERR "Ending with a VACUUM\n"; +$vacuum->execute(); From c4cc72f94449564b56ad9f71d530ee5917af3a97 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 6 Feb 2020 14:26:38 -0500 Subject: [PATCH 9/9] hydra-init: Warn about the schema version migration --- src/script/hydra-init | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/script/hydra-init b/src/script/hydra-init index d813d9fe..1a5f2439 100755 --- a/src/script/hydra-init +++ b/src/script/hydra-init @@ -44,6 +44,17 @@ my @versions = $db->resultset('SchemaVersion')->all; die "couldn't get Hydra schema version!" if scalar @versions != 1; my $schemaVersion = $versions[0]->version; +if ($schemaVersion <= 60) { + print STDERR <