From e176c4edce47258b50f46c08e468a0c1f44dd556 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 20 Sep 2021 14:02:15 +0200 Subject: [PATCH] Bug 28972: DBIC schema changes Signed-off-by: Jonathan Druart --- Koha/Schema/Result/Biblio.pm | 19 ++++++++++-- Koha/Schema/Result/Borrower.pm | 19 ++++++++++-- Koha/Schema/Result/TmpHoldsqueue.pm | 45 ++++++++++++++++++++++++++--- 3 files changed, 75 insertions(+), 8 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 9e652d1028..10e717b369 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -495,6 +495,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 tmp_holdsqueues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "tmp_holdsqueues", + "Koha::Schema::Result::TmpHoldsqueue", + { "foreign.biblionumber" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 virtualshelfcontents Type: has_many @@ -511,8 +526,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fsBT6f/ma1fDlGQoauO7Uw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-20 12:00:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:troBZEbpX+2RhgH2jptVZQ __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 7a1db5dd46..d4c13f1f3d 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1789,6 +1789,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 tmp_holdsqueues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "tmp_holdsqueues", + "Koha::Schema::Result::TmpHoldsqueue", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 user_permissions Type: has_many @@ -1890,8 +1905,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AyU2Z+V4O3ZWV8VhYqXyVg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-20 12:00:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9g9WsdsdPINi2NP4H2A+CA __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/TmpHoldsqueue.pm b/Koha/Schema/Result/TmpHoldsqueue.pm index bb65f43dac..1c14d69a30 100644 --- a/Koha/Schema/Result/TmpHoldsqueue.pm +++ b/Koha/Schema/Result/TmpHoldsqueue.pm @@ -26,6 +26,7 @@ __PACKAGE__->table("tmp_holdsqueue"); =head2 biblionumber data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 =head2 itemnumber @@ -58,6 +59,7 @@ __PACKAGE__->table("tmp_holdsqueue"); =head2 borrowernumber data_type: 'integer' + is_foreign_key: 1 is_nullable: 0 =head2 cardnumber @@ -110,7 +112,7 @@ __PACKAGE__->table("tmp_holdsqueue"); __PACKAGE__->add_columns( "biblionumber", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "itemnumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "barcode", @@ -122,7 +124,7 @@ __PACKAGE__->add_columns( "phone", { data_type => "mediumtext", is_nullable => 1 }, "borrowernumber", - { data_type => "integer", is_nullable => 0 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "cardnumber", { data_type => "varchar", is_nullable => 1, size => 32 }, "reservedate", @@ -143,6 +145,41 @@ __PACKAGE__->add_columns( =head1 RELATIONS +=head2 biblionumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblionumber", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + =head2 itemnumber Type: belongs_to @@ -164,8 +201,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-14 18:14:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tzgAgf+OVO+IncaTr7SZuQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-20 12:00:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ytvFiixR/AIAgTV/5sewcQ # You can replace this text with custom content, and it will be preserved on regeneration -- 2.39.5