From 9206ed23af31654d35b5b38c230c2c766f060eda Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Nov 2018 16:33:56 -0300 Subject: [PATCH] Bug 15836: DBIC Schema change Signed-off-by: Katrin Fischer --- Koha/Schema/Result/ClassSource.pm | 35 +++++++++++- Koha/Schema/Result/ClassSplitRule.pm | 100 +++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 Koha/Schema/Result/ClassSplitRule.pm diff --git a/Koha/Schema/Result/ClassSource.pm b/Koha/Schema/Result/ClassSource.pm index 6c7a4413d5..c64d03ccc8 100644 --- a/Koha/Schema/Result/ClassSource.pm +++ b/Koha/Schema/Result/ClassSource.pm @@ -49,6 +49,14 @@ __PACKAGE__->table("class_sources"); is_nullable: 0 size: 10 +=head2 class_split_rule + + data_type: 'varchar' + default_value: (empty string) + is_foreign_key: 1 + is_nullable: 0 + size: 10 + =cut __PACKAGE__->add_columns( @@ -66,6 +74,14 @@ __PACKAGE__->add_columns( is_nullable => 0, size => 10, }, + "class_split_rule", + { + data_type => "varchar", + default_value => "", + is_foreign_key => 1, + is_nullable => 0, + size => 10, + }, ); =head1 PRIMARY KEY @@ -97,9 +113,24 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, ); +=head2 class_split_rule + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "class_split_rule", + "Koha::Schema::Result::ClassSplitRule", + { class_split_rule => "class_split_rule" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" }, +); + -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tu9NZrk0s8VBgtc1kNpXgg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-11-08 16:33:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fB+fYXMevzvwogIhmVAlgA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/ClassSplitRule.pm b/Koha/Schema/Result/ClassSplitRule.pm new file mode 100644 index 0000000000..59fa6988b9 --- /dev/null +++ b/Koha/Schema/Result/ClassSplitRule.pm @@ -0,0 +1,100 @@ +use utf8; +package Koha::Schema::Result::ClassSplitRule; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ClassSplitRule + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("class_split_rules"); + +=head1 ACCESSORS + +=head2 class_split_rule + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 10 + +=head2 description + + data_type: 'longtext' + is_nullable: 1 + +=head2 split_routine + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 30 + +=head2 split_regex + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 255 + +=cut + +__PACKAGE__->add_columns( + "class_split_rule", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 }, + "description", + { data_type => "longtext", is_nullable => 1 }, + "split_routine", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 30 }, + "split_regex", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("class_split_rule"); + +=head1 RELATIONS + +=head2 class_sources + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "class_sources", + "Koha::Schema::Result::ClassSource", + { "foreign.class_split_rule" => "self.class_split_rule" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-11-08 14:29:56 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nsH0stuc8YqVuaea2MDOfg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.11.0