From 470a0c3981f35cbea29fc1057c0e55c134a0ca5a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 13 Jul 2022 10:34:23 -0300 Subject: [PATCH] Bug 28854: DBIC update Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Item.pm | 34 ++++++++- Koha/Schema/Result/ItemBundle.pm | 113 ++++++++++++++++++++++++++++++ Koha/Schema/Result/ReturnClaim.pm | 18 +---- 3 files changed, 147 insertions(+), 18 deletions(-) create mode 100644 Koha/Schema/Result/ItemBundle.pm diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 01ebbe3636..9a6c397a3b 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -729,6 +729,36 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 item_bundles_hosts + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "item_bundles_hosts", + "Koha::Schema::Result::ItemBundle", + { "foreign.host" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 item_bundles_item + +Type: might_have + +Related object: L + +=cut + +__PACKAGE__->might_have( + "item_bundles_item", + "Koha::Schema::Result::ItemBundle", + { "foreign.item" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item_group_item Type: might_have @@ -895,8 +925,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-08 19:06:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y5EYc49JqMIr3A3aQBTtTQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-13 13:32:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CjfZjLZeYYp3VMuSFJX25A __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/ItemBundle.pm b/Koha/Schema/Result/ItemBundle.pm new file mode 100644 index 0000000000..bb054eaa16 --- /dev/null +++ b/Koha/Schema/Result/ItemBundle.pm @@ -0,0 +1,113 @@ +use utf8; +package Koha::Schema::Result::ItemBundle; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ItemBundle + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("item_bundles"); + +=head1 ACCESSORS + +=head2 item + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 host + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "item", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "host", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("host", "item"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("item_bundles_uniq_1", ["item"]); + +=head1 RELATIONS + +=head2 host + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "host", + "Koha::Schema::Result::Item", + { itemnumber => "host" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 item + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item", + "Koha::Schema::Result::Item", + { itemnumber => "item" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-13 13:32:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PTF+TxbnnYyFQ0XOAaFDWw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/ReturnClaim.pm b/Koha/Schema/Result/ReturnClaim.pm index 9e67c7f0e7..19e93f90df 100644 --- a/Koha/Schema/Result/ReturnClaim.pm +++ b/Koha/Schema/Result/ReturnClaim.pm @@ -170,20 +170,6 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -=head1 UNIQUE CONSTRAINTS - -=head2 C - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->add_unique_constraint("issue_id", ["issue_id"]); - =head1 RELATIONS =head2 borrowernumber @@ -277,8 +263,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-17 10:01:24 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ik93SD3kLNecIyRgsBVKDQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-13 13:32:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WEoUNRgXEivVbg7+Oixv1g =head2 checkout -- 2.39.5