Browse Source

Bug 10855: (RM followup) DBIx update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
3.22.x
Tomás Cohen Arazi 9 years ago
parent
commit
3eb355e892
  1. 134
      Koha/Schema/Result/AdditionalField.pm
  2. 114
      Koha/Schema/Result/AdditionalFieldValue.pm

134
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<additional_fields>
=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</id>
=back
=cut
__PACKAGE__->set_primary_key("id");
=head1 UNIQUE CONSTRAINTS
=head2 C<fields_uniq>
=over 4
=item * L</tablename>
=item * L</name>
=back
=cut
__PACKAGE__->add_unique_constraint("fields_uniq", ["tablename", "name"]);
=head1 RELATIONS
=head2 additional_field_values
Type: has_many
Related object: L<Koha::Schema::Result::AdditionalFieldValue>
=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;

114
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<additional_field_values>
=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</id>
=back
=cut
__PACKAGE__->set_primary_key("id");
=head1 UNIQUE CONSTRAINTS
=head2 C<field_record>
=over 4
=item * L</field_id>
=item * L</record_id>
=back
=cut
__PACKAGE__->add_unique_constraint("field_record", ["field_id", "record_id"]);
=head1 RELATIONS
=head2 field
Type: belongs_to
Related object: L<Koha::Schema::Result::AdditionalField>
=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;
Loading…
Cancel
Save