From b1424118b44d396565672a7a75d3cf47d179d986 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 9 Apr 2020 20:39:04 +0000 Subject: [PATCH] Bug 25103: Schema changes Sponsored-by: The National Library of Finland --- Koha/Schema/Result/AuthorisedValue.pm | 34 +++++++++++++++++++++++++-- Koha/Schema/Result/Issue.pm | 29 ++++++++++++++++++----- Koha/Schema/Result/OldIssue.pm | 29 ++++++++++++++++++----- 3 files changed, 78 insertions(+), 14 deletions(-) diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index 1a65d388c9..c623e4fce9 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/Koha/Schema/Result/AuthorisedValue.pm @@ -144,9 +144,39 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 issues -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-02-22 14:32:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hDlebhEn+f+thqwBo/LOqQ +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "issues", + "Koha::Schema::Result::Issue", + { "foreign.checkout_type" => "self.authorised_value" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 old_issues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "old_issues", + "Koha::Schema::Result::OldIssue", + { "foreign.checkout_type" => "self.authorised_value" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-09 20:37:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2Wzevhr//Lr9VgPd9uHe0g # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm index fed067f64f..e570045386 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -98,10 +98,11 @@ __PACKAGE__->table("issues"); =head2 checkout_type - data_type: 'enum' + data_type: 'varchar' default_value: 'CHECKOUT' - extra: {list => ["CHECKOUT","ONSITE"]} + is_foreign_key: 1 is_nullable: 0 + size: 80 =head2 note @@ -169,10 +170,11 @@ __PACKAGE__->add_columns( }, "checkout_type", { - data_type => "enum", + data_type => "varchar", default_value => "CHECKOUT", - extra => { list => ["CHECKOUT", "ONSITE"] }, + is_foreign_key => 1, is_nullable => 0, + size => 80, }, "note", { data_type => "longtext", is_nullable => 1 }, @@ -234,6 +236,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 checkout_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "checkout_type", + "Koha::Schema::Result::AuthorisedValue", + { authorised_value => "checkout_type" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" }, +); + =head2 itemnumber Type: belongs_to @@ -270,8 +287,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-09 19:47:02 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GIV9oEe2GeiJ/zIg2kZlwA +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-09 20:37:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KAsgzxUm3iuntNs/rQnBgA __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 } diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index acf56ee4ae..c7c0e72107 100644 --- a/Koha/Schema/Result/OldIssue.pm +++ b/Koha/Schema/Result/OldIssue.pm @@ -97,10 +97,11 @@ __PACKAGE__->table("old_issues"); =head2 checkout_type - data_type: 'enum' + data_type: 'varchar' default_value: 'CHECKOUT' - extra: {list => ["CHECKOUT","ONSITE"]} + is_foreign_key: 1 is_nullable: 0 + size: 80 =head2 note @@ -168,10 +169,11 @@ __PACKAGE__->add_columns( }, "checkout_type", { - data_type => "enum", + data_type => "varchar", default_value => "CHECKOUT", - extra => { list => ["CHECKOUT", "ONSITE"] }, + is_foreign_key => 1, is_nullable => 0, + size => 80, }, "note", { data_type => "longtext", is_nullable => 1 }, @@ -219,6 +221,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 checkout_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "checkout_type", + "Koha::Schema::Result::AuthorisedValue", + { authorised_value => "checkout_type" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" }, +); + =head2 itemnumber Type: belongs_to @@ -240,8 +257,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-09 19:47:02 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:J7jzh/kOsynQr52uSGxQ/A +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-09 20:37:11 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gyjaefP3JtK14XMHw2QyTg __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 } -- 2.17.1