From 3eb355e89203a17c04a7b533469ad7ae13e01908 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 2 Oct 2015 15:14:22 -0300 Subject: [PATCH] Bug 10855: (RM followup) DBIx update Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/AdditionalField.pm | 134 +++++++++++++++++++++ Koha/Schema/Result/AdditionalFieldValue.pm | 114 ++++++++++++++++++ 2 files changed, 248 insertions(+) create mode 100644 Koha/Schema/Result/AdditionalField.pm create mode 100644 Koha/Schema/Result/AdditionalFieldValue.pm diff --git a/Koha/Schema/Result/AdditionalField.pm b/Koha/Schema/Result/AdditionalField.pm new file mode 100644 index 0000000000..6a9b1e54b2 --- /dev/null +++ b/Koha/Schema/Result/AdditionalField.pm @@ -0,0 +1,134 @@ +use utf8; +package Koha::Schema::Result::AdditionalField; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AdditionalField + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("additional_fields"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 tablename + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 255 + +=head2 name + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 255 + +=head2 authorised_value_category + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 16 + +=head2 marcfield + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 16 + +=head2 searchable + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "tablename", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, + "name", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, + "authorised_value_category", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 16 }, + "marcfield", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 16 }, + "searchable", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, +); + +=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("fields_uniq", ["tablename", "name"]); + +=head1 RELATIONS + +=head2 additional_field_values + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "additional_field_values", + "Koha::Schema::Result::AdditionalFieldValue", + { "foreign.field_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-10-02 15:12:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vvz9GJNkU4K7bftDNuRHVA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/AdditionalFieldValue.pm b/Koha/Schema/Result/AdditionalFieldValue.pm new file mode 100644 index 0000000000..9dd368d783 --- /dev/null +++ b/Koha/Schema/Result/AdditionalFieldValue.pm @@ -0,0 +1,114 @@ +use utf8; +package Koha::Schema::Result::AdditionalFieldValue; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AdditionalFieldValue + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("additional_field_values"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 field_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 record_id + + data_type: 'integer' + is_nullable: 0 + +=head2 value + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 255 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "field_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "record_id", + { data_type => "integer", is_nullable => 0 }, + "value", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, +); + +=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("field_record", ["field_id", "record_id"]); + +=head1 RELATIONS + +=head2 field + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "field", + "Koha::Schema::Result::AdditionalField", + { id => "field_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-10-02 15:12:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a9G6nhDU9dBDcRRN0vzkLA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5