From b7d1f2f31ac311edf65c9e3096639f858b443463 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 4 Aug 2022 14:44:13 +1200 Subject: [PATCH] Bug 15516: Schema updates Signed-off-by: Michal Denar --- Koha/Schema/Result/HoldGroup.pm | 95 ++++++++++++++++++++++++++++++++ Koha/Schema/Result/OldReserve.pm | 40 +++++++++++++- Koha/Schema/Result/Reserve.pm | 40 +++++++++++++- 3 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/HoldGroup.pm diff --git a/Koha/Schema/Result/HoldGroup.pm b/Koha/Schema/Result/HoldGroup.pm new file mode 100644 index 0000000000..e5d6b2298a --- /dev/null +++ b/Koha/Schema/Result/HoldGroup.pm @@ -0,0 +1,95 @@ +use utf8; +package Koha::Schema::Result::HoldGroup; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::HoldGroup + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("hold_groups"); + +=head1 ACCESSORS + +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_auto_increment: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_auto_increment => 1, + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("hold_group_id"); + +=head1 RELATIONS + +=head2 old_reserves + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "old_reserves", + "Koha::Schema::Result::OldReserve", + { "foreign.hold_group_id" => "self.hold_group_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 reserves + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "reserves", + "Koha::Schema::Result::Reserve", + { "foreign.hold_group_id" => "self.hold_group_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-08-04 14:43:31 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5Xzfn2C7H+Z8R9PUBPFkYw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm index 96c7373c16..2f164e2b78 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -215,6 +215,15 @@ Is the hpld placed at item level Is this a non priority hold +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 1 + +The id of a group of titles reservations fulfilled when one title is picked + =cut __PACKAGE__->add_columns( @@ -280,6 +289,13 @@ __PACKAGE__->add_columns( { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "non_priority", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -336,6 +352,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 hold_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "hold_group", + "Koha::Schema::Result::HoldGroup", + { hold_group_id => "hold_group_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "SET NULL", + }, +); + =head2 itemnumber Type: belongs_to @@ -377,8 +413,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:08:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A3iHpf4nDeIpPsapNzdv8w +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-08-04 14:43:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:g78WDUT6McwBgPbtfN0fzg __PACKAGE__->belongs_to( "item", diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 08aac12c2e..993900bbce 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -214,6 +214,15 @@ Is the hpld placed at item level Is this a non priority hold +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 1 + +The id of a group of titles reservations fulfilled when one title is picked + =cut __PACKAGE__->add_columns( @@ -289,6 +298,13 @@ __PACKAGE__->add_columns( { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "non_priority", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -385,6 +401,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 hold_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "hold_group", + "Koha::Schema::Result::HoldGroup", + { hold_group_id => "hold_group_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -426,8 +462,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-22 17:37:42 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kYRPPeoVo0WMk1gH+qmi/w +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-08-04 14:43:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hvR70bywOsosk9tEG8dWSA __PACKAGE__->belongs_to( "item", -- 2.30.2