From afaf5d17c98f621a32aab6d03e193c42a140979c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 27 Apr 2023 09:33:15 +0000 Subject: [PATCH] Bug 22440: Schema Update Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Biblio.pm | 19 +++++++++++++++++-- Koha/Schema/Result/Illrequest.pm | 27 ++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 1862646c2c..cfa01af52b 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -330,6 +330,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illrequests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequests", + "Koha::Schema::Result::Illrequest", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item_groups Type: has_many @@ -586,8 +601,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-06 14:23:57 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j4elmpNlSt3eMlzF1yXCxg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-26 08:46:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BHzc1nBWWsgVIGoCBsbEEA __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 5f1b0230dd..922fdda3c8 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -43,6 +43,7 @@ Patron associated with request =head2 biblio_id data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 Potential bib linked to request @@ -187,7 +188,7 @@ __PACKAGE__->add_columns( "borrowernumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "biblio_id", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "due_date", { data_type => "datetime", @@ -245,6 +246,26 @@ __PACKAGE__->set_primary_key("illrequest_id"); =head1 RELATIONS +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblio_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 borrowernumber Type: belongs_to @@ -331,8 +352,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-23 18:44:13 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:on9OCRON/U0uR+m9aPIKPg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-26 08:46:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a/x5km4Wh3NDancIsj9NwA __PACKAGE__->has_many( "comments", -- 2.40.1