From 54ed23f1861c0a6656d6c9d825b3fd1cc8426a9d Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 3 Feb 2021 10:04:30 +1300 Subject: [PATCH] Bug 14237: Schema updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Stelzenmüller Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- Koha/Schema/Result/Biblio.pm | 19 +++++++++++++++-- Koha/Schema/Result/CourseItem.pm | 36 +++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 74a46419b4..dd14f2d807 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -270,6 +270,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 course_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "course_items", + "Koha::Schema::Result::CourseItem", + { "foreign.biblionumber" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 cover_images Type: has_many @@ -481,8 +496,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:nmmsZusHYNAMimE9sImSNg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-02-03 10:03:26 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YVZN5K/K1v7Kj2yYGwT2CQ __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/CourseItem.pm b/Koha/Schema/Result/CourseItem.pm index de50b7987e..0cf436962d 100644 --- a/Koha/Schema/Result/CourseItem.pm +++ b/Koha/Schema/Result/CourseItem.pm @@ -35,9 +35,13 @@ course item id data_type: 'integer' is_foreign_key: 1 - is_nullable: 0 + is_nullable: 1 + +=head2 biblionumber -items.itemnumber for the item on reserve + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 =head2 itype @@ -184,6 +188,8 @@ __PACKAGE__->add_columns( "ci_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "itemnumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "biblionumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "itype", { data_type => "varchar", is_nullable => 1, size => 10 }, @@ -259,6 +265,21 @@ __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]); =head1 RELATIONS +=head2 biblionumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblionumber", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + =head2 course_reserves Type: has_many @@ -346,12 +367,17 @@ __PACKAGE__->belongs_to( "itemnumber", "Koha::Schema::Result::Item", { itemnumber => "itemnumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:g97N0MosrfgL6Jg3NVJUFA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-02-03 10:03:26 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kImBuor/tqSbLlPDt+d2fg __PACKAGE__->add_columns( '+itype_enabled' => { is_boolean => 1 }, -- 2.39.5