From 67aeb80535910035789b775db65ed9e6bc58da8e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 22 Jul 2021 10:55:04 +0100 Subject: [PATCH] Bug 22690: DBIC Schema Updates --- Koha/Schema/Result/Biblio.pm | 19 +++++++- Koha/Schema/Result/Borrower.pm | 19 +++++++- Koha/Schema/Result/Item.pm | 19 +++++++- Koha/Schema/Result/Linktracker.pm | 75 ++++++++++++++++++++++++++++--- 4 files changed, 121 insertions(+), 11 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index dd14f2d807..3e0db5499a 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 linktrackers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "linktrackers", + "Koha::Schema::Result::Linktracker", + { "foreign.biblionumber" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 old_reserves Type: has_many @@ -496,8 +511,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-02-03 10:03:26 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YVZN5K/K1v7Kj2yYGwT2CQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-22 09:54:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FjffUcBiOmDhB5Wod9urpg __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 68abbc11aa..29d7eaf170 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1349,6 +1349,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 linktrackers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "linktrackers", + "Koha::Schema::Result::Linktracker", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 message_queues Type: has_many @@ -1875,8 +1890,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-12 13:40:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IKPb4912o8oCHtmFAi6FPQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-22 09:54:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gjSiLeCD1Xe3+SmyGgDq9g __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 864095bcf6..c377ac8a9b 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -744,6 +744,21 @@ __PACKAGE__->might_have( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 linktrackers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "linktrackers", + "Koha::Schema::Result::Linktracker", + { "foreign.itemnumber" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 old_issues Type: has_many @@ -850,8 +865,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:U5Tm2JfUnfhACRDJ4SpFgQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-22 09:54:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T8g2topYVrbdqhw5UsCmDA __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Linktracker.pm b/Koha/Schema/Result/Linktracker.pm index 7a4e495583..2108d8210f 100644 --- a/Koha/Schema/Result/Linktracker.pm +++ b/Koha/Schema/Result/Linktracker.pm @@ -34,6 +34,7 @@ primary key identifier =head2 biblionumber data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 biblionumber of the record the link is from @@ -41,6 +42,7 @@ biblionumber of the record the link is from =head2 itemnumber data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 itemnumber if applicable that the link was from @@ -48,6 +50,7 @@ itemnumber if applicable that the link was from =head2 borrowernumber data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 borrowernumber who clicked the link @@ -73,11 +76,11 @@ __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "biblionumber", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "itemnumber", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "borrowernumber", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "url", { data_type => "mediumtext", is_nullable => 1 }, "timeclicked", @@ -100,9 +103,71 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 RELATIONS -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dNzvrDz4qAO/rvZaYUEjAg +=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 => "SET NULL", + on_update => "SET NULL", + }, +); + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "SET NULL", + }, +); + +=head2 itemnumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "itemnumber", + "Koha::Schema::Result::Item", + { itemnumber => "itemnumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "SET NULL", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-07-22 09:54:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/OpO+hgnOTsMMXApkRsT4A # You can replace this text with custom content, and it will be preserved on regeneration -- 2.20.1