From 7e0ff2da95b631728aa5e83e1c66a175c406a952 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 25 Apr 2022 09:51:24 -0300 Subject: [PATCH] Bug 30449: DBIC updates Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall --- Koha/Schema/Result/BorrowerAttributeType.pm | 27 ++++++++++++++++++--- Koha/Schema/Result/Category.pm | 19 +++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm index ce969376ba..9a4b7125ce 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -98,6 +98,7 @@ defines if this field displays in checkout screens =head2 category_code data_type: 'varchar' + is_foreign_key: 1 is_nullable: 1 size: 10 @@ -150,7 +151,7 @@ __PACKAGE__->add_columns( "display_checkout", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "category_code", - { data_type => "varchar", is_nullable => 1, size => 10 }, + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, "class", { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, "keep_for_pseudonymization", @@ -203,6 +204,26 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 category_code + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "category_code", + "Koha::Schema::Result::Category", + { categorycode => "category_code" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "RESTRICT", + on_update => "RESTRICT", + }, +); + =head2 pseudonymized_borrower_attributes Type: has_many @@ -219,8 +240,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a/IA2iqSJqg3oOS+o1nXFg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-25 12:50:55 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VgJP4Ugfz0sN3YoJk/tshA __PACKAGE__->add_columns( '+keep_for_pseudonymization' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm index 567bf33329..6319df90d4 100644 --- a/Koha/Schema/Result/Category.pm +++ b/Koha/Schema/Result/Category.pm @@ -268,6 +268,21 @@ __PACKAGE__->set_primary_key("categorycode"); =head1 RELATIONS +=head2 borrower_attribute_types + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "borrower_attribute_types", + "Koha::Schema::Result::BorrowerAttributeType", + { "foreign.category_code" => "self.categorycode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 borrower_message_preferences Type: has_many @@ -329,8 +344,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-19 14:20:11 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xrnHXXv5sd3S2sMEKzHLmA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-25 12:50:56 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vEpp1HRkUOvPyWd/yAsxng __PACKAGE__->add_columns( '+exclude_from_local_holds_priority' => { is_boolean => 1 }, -- 2.39.5