From 818417b16bed105318c89b17c18153a45ecbe8c3 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Tue, 28 Apr 2020 09:47:52 +0300 Subject: [PATCH 2/4] Bug 9525: Schema changes - DO NOT PUSH --- Koha/Schema/Result/Branch.pm | 30 ++++++ Koha/Schema/Result/FloatingMatrix.pm | 145 +++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 Koha/Schema/Result/FloatingMatrix.pm diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 22d3172aae..6225ffff9d 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -533,6 +533,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 floating_matrixes_from_branch + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "floating_matrixes_from_branch", + "Koha::Schema::Result::FloatingMatrix", + { "foreign.from_branch" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 floating_matrixes_to_branch + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "floating_matrixes_to_branch", + "Koha::Schema::Result::FloatingMatrix", + { "foreign.to_branch" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 hold_fill_targets Type: has_many diff --git a/Koha/Schema/Result/FloatingMatrix.pm b/Koha/Schema/Result/FloatingMatrix.pm new file mode 100644 index 0000000000..26d273aab4 --- /dev/null +++ b/Koha/Schema/Result/FloatingMatrix.pm @@ -0,0 +1,145 @@ +use utf8; +package Koha::Schema::Result::FloatingMatrix; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::FloatingMatrix + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("floating_matrix"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 from_branch + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 to_branch + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 floating + + data_type: 'enum' + default_value: 'ALWAYS' + extra: {list => ["ALWAYS","POSSIBLE","CONDITIONAL"]} + is_nullable: 0 + +=head2 condition_rules + + data_type: 'varchar' + is_nullable: 1 + size: 100 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "from_branch", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "to_branch", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "floating", + { + data_type => "enum", + default_value => "ALWAYS", + extra => { list => ["ALWAYS", "POSSIBLE", "CONDITIONAL"] }, + is_nullable => 0, + }, + "condition_rules", + { data_type => "varchar", is_nullable => 1, size => 100 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("floating_matrix_uniq_branches", ["from_branch", "to_branch"]); + +=head1 RELATIONS + +=head2 from_branch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "from_branch", + "Koha::Schema::Result::Branch", + { branchcode => "from_branch" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 to_branch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "to_branch", + "Koha::Schema::Result::Branch", + { branchcode => "to_branch" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-03-10 09:28:20 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jOVU1Wag0o96NkjrnPjsvg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.17.1