From 1e75506f80a913eae9a903c0bc7eb6b425664da1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 30 Aug 2016 11:56:14 +0100 Subject: [PATCH] Bug 17216: Update DBIC Schema Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher --- Koha/Schema/Result/AuthorisedValue.pm | 28 +++++++++++++++++-- Koha/Schema/Result/AuthorisedValueCategory.pm | 24 +++++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index d1f6af6b76..394844d6d9 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/Koha/Schema/Result/AuthorisedValue.pm @@ -33,6 +33,7 @@ __PACKAGE__->table("authorised_values"); data_type: 'varchar' default_value: (empty string) + is_foreign_key: 1 is_nullable: 0 size: 32 @@ -67,7 +68,13 @@ __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "category", - { data_type => "varchar", default_value => "", is_nullable => 0, size => 32 }, + { + data_type => "varchar", + default_value => "", + is_foreign_key => 1, + is_nullable => 0, + size => 32, + }, "authorised_value", { data_type => "varchar", default_value => "", is_nullable => 0, size => 80 }, "lib", @@ -107,9 +114,24 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 category + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "category", + "Koha::Schema::Result::AuthorisedValueCategory", + { category_name => "category" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-29 11:50:45 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VtpTwYpCMG3VVmsrQspdxw +# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-30 11:52:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LOArv8JQ0aiTZgcy+jb7pA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/AuthorisedValueCategory.pm b/Koha/Schema/Result/AuthorisedValueCategory.pm index c5de266452..596db1471d 100644 --- a/Koha/Schema/Result/AuthorisedValueCategory.pm +++ b/Koha/Schema/Result/AuthorisedValueCategory.pm @@ -26,14 +26,15 @@ __PACKAGE__->table("authorised_value_categories"); =head2 category_name data_type: 'varchar' + default_value: (empty string) is_nullable: 0 - size: 80 + size: 32 =cut __PACKAGE__->add_columns( "category_name", - { data_type => "varchar", is_nullable => 0, size => 80 }, + { data_type => "varchar", default_value => "", is_nullable => 0, size => 32 }, ); =head1 PRIMARY KEY @@ -50,6 +51,21 @@ __PACKAGE__->set_primary_key("category_name"); =head1 RELATIONS +=head2 authorised_values + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "authorised_values", + "Koha::Schema::Result::AuthorisedValue", + { "foreign.category" => "self.category_name" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 items_search_fields Type: has_many @@ -66,8 +82,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-29 11:50:45 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fF91wGF5/xHvp8JX5fAAtw +# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-30 11:54:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T8LzWM/O8zSGpRhTZbzvJA # You can replace this text with custom code or comments, and it will be preserved on regeneration -- 2.39.5