From b339e95a939fc14f2fbaf79c0dd6baaf0eee0bc2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Mar 2024 17:08:21 +0000 Subject: [PATCH] Bug 36120: Schema update Sponsored-by: Cuyahoga County Public Library Signed-off-by: Lisette Scheer Signed-off-by: Kristi Krueger Signed-off-by: Nick Clemens --- Koha/Schema/Result/Booking.pm | 35 +++++++++++++++++++++++++++++++++-- Koha/Schema/Result/Branch.pm | 15 +++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Koha/Schema/Result/Booking.pm b/Koha/Schema/Result/Booking.pm index 4c3a9715290..fb5a42b82d1 100644 --- a/Koha/Schema/Result/Booking.pm +++ b/Koha/Schema/Result/Booking.pm @@ -57,6 +57,15 @@ foreign key from the biblio table defining which bib record this booking is on foreign key from the items table defining the specific item the patron has placed a booking for +=head2 pickup_library_id + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 10 + +Identifier for booking pickup library + =head2 start_date data_type: 'datetime' @@ -94,6 +103,8 @@ __PACKAGE__->add_columns( }, "item_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "pickup_library_id", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, "start_date", { data_type => "datetime", @@ -172,9 +183,29 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +=head2 pickup_library + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "pickup_library", + "Koha::Schema::Result::Branch", + { branchcode => "pickup_library_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-04 10:01:46 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LoOYu7IflBkC4+VUZLd+Tg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-03-07 17:07:54 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IEYMaWaOX+bQpm36pdTfyg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 935cfe1972d..ddcb0cdfe2b 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -380,6 +380,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 bookings + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "bookings", + "Koha::Schema::Result::Booking", + { "foreign.pickup_library_id" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 borrower_attribute_types_branches Type: has_many -- 2.44.0