From ff85c6812e58869f804316ef3121988be5332718 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 12 Sep 2019 16:26:32 +0100 Subject: [PATCH] Bug 15497: Modify schemas Sponsored-by: Northeast Kansas Library System Sponsored-by: Southeast Kansas Library System Sponsored-by: Central Kansas Library System Signed-off-by: Jessica Zairo Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Branch.pm | 19 +++++- Koha/Schema/Result/Itemtype.pm | 19 +++++- Koha/Schema/Result/ItemtypesBranch.pm | 87 +++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/ItemtypesBranch.pm diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index b500147ea4..bf8f6d8efc 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -541,6 +541,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 itemtypes_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "itemtypes_branches", + "Koha::Schema::Result::ItemtypesBranch", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 library_groups Type: has_many @@ -647,8 +662,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-29 15:02:52 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y+tNq5YiUeUOyAwB4r6GHw +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-07-04 04:56:47 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:15/s0/8d2cNB9YLLlsEY4w __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index f7f4fe1bf6..073c527b7b 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -181,6 +181,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 itemtypes_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "itemtypes_branches", + "Koha::Schema::Result::ItemtypesBranch", + { "foreign.itemtype" => "self.itemtype" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 old_reserves Type: has_many @@ -212,8 +227,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-29 15:02:52 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:X7Py35p8kotheBvJjuwDcA +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-07-04 04:56:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Qo6jabJSQGeYJ542ebSJfg # Use the ItemtypeLocalization view to create the join on localization our $LANGUAGE; diff --git a/Koha/Schema/Result/ItemtypesBranch.pm b/Koha/Schema/Result/ItemtypesBranch.pm new file mode 100644 index 0000000000..9c54614440 --- /dev/null +++ b/Koha/Schema/Result/ItemtypesBranch.pm @@ -0,0 +1,87 @@ +use utf8; +package Koha::Schema::Result::ItemtypesBranch; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ItemtypesBranch + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("itemtypes_branches"); + +=head1 ACCESSORS + +=head2 itemtype + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=cut + +__PACKAGE__->add_columns( + "itemtype", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, +); + +=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 => "RESTRICT" }, +); + +=head2 itemtype + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "itemtype", + "Koha::Schema::Result::Itemtype", + { itemtype => "itemtype" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-07-04 04:56:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cBTswjKV8VWN1iueB+PygQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5