From 75e11a90e5807aa791142aa6ad328edaf0ccdb53 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 8 Feb 2024 14:18:31 +0000 Subject: [PATCH] Bug 22421: Schema Update Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Accountline.pm | 55 +++++++++++++++++++++++++++++-- Koha/Schema/Result/Issue.pm | 19 +++++++++-- Koha/Schema/Result/OldIssue.pm | 19 +++++++++-- 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index d1ba673cf2d..1903a552ec6 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -32,6 +32,13 @@ __PACKAGE__->table("accountlines"); =head2 issue_id data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 old_issue_id + + data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 =head2 borrowernumber @@ -150,7 +157,9 @@ __PACKAGE__->add_columns( "accountlines_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "issue_id", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "old_issue_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "borrowernumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "itemnumber", @@ -335,6 +344,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 issue + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "issue", + "Koha::Schema::Result::Issue", + { issue_id => "issue_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -375,6 +404,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 old_issue + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "old_issue", + "Koha::Schema::Result::OldIssue", + { issue_id => "old_issue_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 register Type: belongs_to @@ -396,8 +445,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:21:02 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PjQR7oUkefiDt+eV69jZ3A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-02-08 14:18:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aVLdvK1lek01lZ0mbaCwZQ =head2 patron diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm index 05fde17f46e..ca46153e29d 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -260,6 +260,21 @@ __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]); =head1 RELATIONS +=head2 accountlines + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "accountlines", + "Koha::Schema::Result::Accountline", + { "foreign.issue_id" => "self.issue_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 borrowernumber Type: belongs_to @@ -311,8 +326,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-09-12 11:34:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eNzDAKc3bmTLWeDu8u4nTQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-02-08 14:18:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7VMPEayWBRQ9ga7uhQGR4w __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index 50ef4a82e03..de1a498af13 100644 --- a/Koha/Schema/Result/OldIssue.pm +++ b/Koha/Schema/Result/OldIssue.pm @@ -245,6 +245,21 @@ __PACKAGE__->set_primary_key("issue_id"); =head1 RELATIONS +=head2 accountlines + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "accountlines", + "Koha::Schema::Result::Accountline", + { "foreign.old_issue_id" => "self.issue_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 borrowernumber Type: belongs_to @@ -306,8 +321,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-18 12:35:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0XlDHyg8uB3oD9/jJtOxRg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-02-08 14:18:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Pp1/8rwY5N9NBkgNCagvow __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, -- 2.47.0