From 9afaf322b38ef5b26d52f10b705d77ddb1f70dd0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 30 Jul 2015 16:07:21 +0200 Subject: [PATCH] Use latest DBIx::Class::Schema::Loader --- src/lib/Hydra/Schema/Builds.pm | 23 +++++++-- src/lib/Hydra/Schema/SystemStatus.pm | 75 ++++++++++++++++++++++++++++ src/sql/Makefile.am | 6 +-- src/sql/update-dbix.pl | 8 +++ 4 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 src/lib/Hydra/Schema/SystemStatus.pm create mode 100644 src/sql/update-dbix.pl diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 852c6c32..a5abce08 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -401,6 +401,21 @@ __PACKAGE__->has_many( undef, ); +=head2 buildsteps_propagatedfroms + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "buildsteps_propagatedfroms", + "Hydra::Schema::BuildSteps", + { "foreign.propagatedfrom" => "self.id" }, + undef, +); + =head2 job Type: belongs_to @@ -509,19 +524,19 @@ __PACKAGE__->many_to_many( Type: many_to_many -Composing rels: L -> constituent +Composing rels: L -> constituent =cut __PACKAGE__->many_to_many( "constituents", - "aggregateconstituents_constituents", + "aggregateconstituents_aggregates", "constituent", ); -# Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-09-30 15:38:03 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kMPje7yi/yDqxGRQcC2I/Q +# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:03:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EwxiaQpqbdzI9RvU0uUtLQ __PACKAGE__->has_many( "dependents", diff --git a/src/lib/Hydra/Schema/SystemStatus.pm b/src/lib/Hydra/Schema/SystemStatus.pm new file mode 100644 index 00000000..7c99e780 --- /dev/null +++ b/src/lib/Hydra/Schema/SystemStatus.pm @@ -0,0 +1,75 @@ +use utf8; +package Hydra::Schema::SystemStatus; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Hydra::Schema::SystemStatus + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 COMPONENTS LOADED + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->load_components("+Hydra::Component::ToJSON"); + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("SystemStatus"); + +=head1 ACCESSORS + +=head2 what + + data_type: 'text' + is_nullable: 0 + +=head2 status + + data_type: 'json' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "what", + { data_type => "text", is_nullable => 0 }, + "status", + { data_type => "json", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__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 + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/src/sql/Makefile.am b/src/sql/Makefile.am index 2642ff95..85613a5b 100644 --- a/src/sql/Makefile.am +++ b/src/sql/Makefile.am @@ -4,8 +4,8 @@ nobase_dist_sql_DATA = \ hydra.sql \ hydra-sqlite.sql \ test.sql \ - upgrade-*.sql - + upgrade-*.sql \ + update-dbix.pl hydra-postgresql.sql: hydra.sql cpp -P -E -traditional-cpp -DPOSTGRESQL hydra.sql > $@ || rm -f $@ @@ -16,4 +16,4 @@ hydra-sqlite.sql: hydra.sql 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 -e 'make_schema_at("Hydra::Schema", { naming => { ALL => "v5" }, relationships => 1, moniker_map => sub {return "$$_";}, components => [ "+Hydra::Component::ToJSON" ], }, ["dbi:SQLite:tmp.sqlite"])' + perl -I ../lib -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:../lib update-dbix.pl diff --git a/src/sql/update-dbix.pl b/src/sql/update-dbix.pl new file mode 100644 index 00000000..9089617a --- /dev/null +++ b/src/sql/update-dbix.pl @@ -0,0 +1,8 @@ +make_schema_at("Hydra::Schema", { + naming => { ALL => "v5" }, + relationships => 1, + moniker_map => sub { return "$_"; }, + components => [ "+Hydra::Component::ToJSON" ], + rel_name_map => { buildsteps_builds => "buildsteps" } +}, ["dbi:SQLite:tmp.sqlite"]); +