From 72e5459a08d5697878efc39fd5cb6ea69ad3677a Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 16 Apr 2019 02:31:39 +0000 Subject: [PATCH] Bug 15516: (follow-up) Schema updates Signed-off-by: Michal Denar Signed-off-by: Michal Denar --- Koha/Schema/Result/HoldGroup.pm | 95 ++++++++++++++++++++++++++++++++++++++++ Koha/Schema/Result/OldReserve.pm | 38 +++++++++++++++- Koha/Schema/Result/Reserve.pm | 38 +++++++++++++++- 3 files changed, 167 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 0000000..71a7a32 --- /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_group"); + +=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.07042 @ 2019-04-15 22:28:13 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xKP5eBTiypxGQAU7/drVWg + + +# 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 851f00c..b2de882 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -137,6 +137,13 @@ __PACKAGE__->table("old_reserves"); is_nullable: 1 size: 10 +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -192,6 +199,13 @@ __PACKAGE__->add_columns( }, "itemtype", { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -248,6 +262,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 @@ -289,8 +323,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ynb6NtiTN8ZZur2YCvxlNg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-15 22:28:13 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q56t7dvPQttsLQfmPNcIbA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 1ba1c97..f489df7 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -141,6 +141,13 @@ __PACKAGE__->table("reserves"); is_nullable: 1 size: 10 +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -206,6 +213,13 @@ __PACKAGE__->add_columns( }, "itemtype", { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -272,6 +286,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 @@ -313,8 +347,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2GCET9quFpUvzuN7MUWZNw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-15 22:28:13 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MigQjMCoTzC4uLObNC++Pw __PACKAGE__->belongs_to( "item", -- 2.1.4