From 267b2aee76f92545c13cdabbe8e0a249d50f6f2d Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 13 Feb 2020 22:00:42 +0000 Subject: [PATCH] Bug 24289: (follow up) add dbic schema changes Signed-off-by: Lucas Gass --- Koha/Schema/Result/Branch.pm | 34 +++++++++++++++++++++++-- Koha/Schema/Result/RepeatableHoliday.pm | 25 +++++++++++++++--- Koha/Schema/Result/SpecialHoliday.pm | 25 +++++++++++++++--- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 40d54c0f09..ed739c130d 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -601,6 +601,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 repeatable_holidays + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "repeatable_holidays", + "Koha::Schema::Result::RepeatableHoliday", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 reserves Type: has_many @@ -616,6 +631,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 special_holidays + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "special_holidays", + "Koha::Schema::Result::SpecialHoliday", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 stockrotationstages Type: has_many @@ -677,8 +707,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-11 12:56:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pKohWwsuUHcZSlGDj7zmcw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-13 21:36:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5vAIcmNT9vlNFMulL5Wz3A __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } diff --git a/Koha/Schema/Result/RepeatableHoliday.pm b/Koha/Schema/Result/RepeatableHoliday.pm index d1185c4fe8..3f1d72dd60 100644 --- a/Koha/Schema/Result/RepeatableHoliday.pm +++ b/Koha/Schema/Result/RepeatableHoliday.pm @@ -32,7 +32,7 @@ __PACKAGE__->table("repeatable_holidays"); =head2 branchcode data_type: 'varchar' - default_value: (empty string) + is_foreign_key: 1 is_nullable: 0 size: 10 @@ -69,7 +69,7 @@ __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "branchcode", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, "weekday", { data_type => "smallint", is_nullable => 1 }, "day", @@ -94,9 +94,26 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 RELATIONS + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tp+p/e8mXWJv33yYXNMoww +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-13 21:36:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:g8KVOpKx/AOEZU85hnDMzw # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/SpecialHoliday.pm b/Koha/Schema/Result/SpecialHoliday.pm index 29ff8bb0e1..e1e8e0ce6d 100644 --- a/Koha/Schema/Result/SpecialHoliday.pm +++ b/Koha/Schema/Result/SpecialHoliday.pm @@ -32,7 +32,7 @@ __PACKAGE__->table("special_holidays"); =head2 branchcode data_type: 'varchar' - default_value: (empty string) + is_foreign_key: 1 is_nullable: 0 size: 10 @@ -78,7 +78,7 @@ __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "branchcode", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, "day", { data_type => "smallint", default_value => 0, is_nullable => 0 }, "month", @@ -105,9 +105,26 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 RELATIONS + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9Qc6VbOUqX83upThUC//oA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-13 21:36:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VVmNyNpUlwO2flg/WWoeXA # You can replace this text with custom content, and it will be preserved on regeneration -- 2.39.5