From d21f626e8067b028897c6c0d7e2d9fa99a7a36e0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 27 Aug 2021 10:43:38 +0200 Subject: [PATCH] Bug 22690: DBIC schema changes Signed-off-by: Jonathan Druart --- 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..9e652d1028 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-08-27 08:42:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fsBT6f/ma1fDlGQoauO7Uw __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index f0332fcfe9..7a1db5dd46 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1364,6 +1364,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-16 07:12:03 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SWOGE6/WDsjzXcgfxmVQ4A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-08-27 08:42:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AyU2Z+V4O3ZWV8VhYqXyVg __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 864095bcf6..a53e10e98a 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-08-27 08:42:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SjZn3haOtUZWu1jrMigjNQ __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..0bdad4eade 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-08-27 08:42:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ksT3i//fQn+HnBKt4YZlhg # You can replace this text with custom content, and it will be preserved on regeneration -- 2.39.5