From 156c4007be34b4a41bc5c1a16b04f8b4c5d42093 Mon Sep 17 00:00:00 2001 From: Victor Grousset/tuxayo Date: Sun, 31 Jul 2022 23:11:02 +0200 Subject: [PATCH] [DO NOT PUSH] Bug 18745: DBIC schema changes --- Koha/Schema/Result/Aqbookseller.pm | 34 ++++++++++++++++++++++++++++-- Koha/Schema/Result/Serial.pm | 34 ++++++++++++++++++++++++++++-- Koha/Schema/Result/Subscription.pm | 28 ++++++++++++++++++++---- 3 files changed, 88 insertions(+), 8 deletions(-) diff --git a/Koha/Schema/Result/Aqbookseller.pm b/Koha/Schema/Result/Aqbookseller.pm index 4c5d19a0e2..a45e6f6fba 100644 --- a/Koha/Schema/Result/Aqbookseller.pm +++ b/Koha/Schema/Result/Aqbookseller.pm @@ -371,6 +371,36 @@ __PACKAGE__->belongs_to( }, ); +=head2 serials + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "serials", + "Koha::Schema::Result::Serial", + { "foreign.aqbooksellerid" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 subscriptions + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "subscriptions", + "Koha::Schema::Result::Subscription", + { "foreign.aqbooksellerid" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 vendor_edi_accounts Type: has_many @@ -387,8 +417,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:qu4OqSCsEKEeJD9VtOEd4g +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2022-07-31 21:00:40 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5/SMpqTy9WLK3cqqL20jg __PACKAGE__->add_columns( '+active' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Serial.pm b/Koha/Schema/Result/Serial.pm index 46c22cc420..8ca51930fe 100644 --- a/Koha/Schema/Result/Serial.pm +++ b/Koha/Schema/Result/Serial.pm @@ -47,6 +47,14 @@ foreign key for the biblio.biblionumber that this issue is attached to foreign key to the subscription.subscriptionid that this issue is part of +=head2 aqbooksellerid + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +the subscription's bookseller at the time of creation (used for claims) + =head2 serialseq data_type: 'varchar' @@ -151,6 +159,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "subscriptionid", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "aqbooksellerid", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "serialseq", { data_type => "varchar", default_value => "", is_nullable => 0, size => 100 }, "serialseq_x", @@ -191,6 +201,26 @@ __PACKAGE__->set_primary_key("serialid"); =head1 RELATIONS +=head2 aqbooksellerid + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "aqbooksellerid", + "Koha::Schema::Result::Aqbookseller", + { id => "aqbooksellerid" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "RESTRICT", + on_update => "RESTRICT", + }, +); + =head2 biblionumber Type: belongs_to @@ -237,8 +267,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SD7llCvCO+/67cXetzRKPQ +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2022-07-31 21:00:41 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zqosYcct1Mu/MqsBKHWJmA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Subscription.pm b/Koha/Schema/Result/Subscription.pm index 900039dc52..7063fcc639 100644 --- a/Koha/Schema/Result/Subscription.pm +++ b/Koha/Schema/Result/Subscription.pm @@ -59,7 +59,7 @@ start date for this subscription =head2 aqbooksellerid data_type: 'integer' - default_value: 0 + is_foreign_key: 1 is_nullable: 1 foreign key for aqbooksellers.id to link to the vendor @@ -346,7 +346,7 @@ __PACKAGE__->add_columns( "startdate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "aqbooksellerid", - { data_type => "integer", default_value => 0, is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "cost", { data_type => "integer", default_value => 0, is_nullable => 1 }, "aqbudgetid", @@ -441,6 +441,26 @@ __PACKAGE__->set_primary_key("subscriptionid"); =head1 RELATIONS +=head2 aqbooksellerid + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "aqbooksellerid", + "Koha::Schema::Result::Aqbookseller", + { id => "aqbooksellerid" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "RESTRICT", + on_update => "CASCADE", + }, +); + =head2 aqorders Type: has_many @@ -557,8 +577,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-07-05 17:45:12 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MFOz3AKUVSPuQv6kMb1EbA +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2022-07-31 21:00:41 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+cpI7T2LKWUL+lSXD/nFeg __PACKAGE__->has_many( "additional_field_values", -- 2.37.1