From b3fb8a7a1586008b91dcc8a03375c7ab972faff4 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 20 Apr 2023 15:20:52 -0300 Subject: [PATCH] Bug 33574: DBIC schema Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Aqbookseller.pm | 19 ++++- Koha/Schema/Result/AqbooksellerAlias.pm | 101 ++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 Koha/Schema/Result/AqbooksellerAlias.pm diff --git a/Koha/Schema/Result/Aqbookseller.pm b/Koha/Schema/Result/Aqbookseller.pm index d277785eb4..ae97e156f0 100644 --- a/Koha/Schema/Result/Aqbookseller.pm +++ b/Koha/Schema/Result/Aqbookseller.pm @@ -289,6 +289,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 aqbookseller_aliases + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "aqbookseller_aliases", + "Koha::Schema::Result::AqbooksellerAlias", + { "foreign.vendor_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 aqcontacts Type: has_many @@ -465,8 +480,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-19 09:20:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Xxg454HATZToWE01NY8eJw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-20 18:19:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TPJaVCb2TvxKCxrWOa3b9A __PACKAGE__->add_columns( '+active' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/AqbooksellerAlias.pm b/Koha/Schema/Result/AqbooksellerAlias.pm new file mode 100644 index 0000000000..eb329ccdbc --- /dev/null +++ b/Koha/Schema/Result/AqbooksellerAlias.pm @@ -0,0 +1,101 @@ +use utf8; +package Koha::Schema::Result::AqbooksellerAlias; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::AqbooksellerAlias + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("aqbookseller_aliases"); + +=head1 ACCESSORS + +=head2 alias_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key and unique identifier assigned by Koha + +=head2 vendor_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +link to the vendor + +=head2 alias + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +the alias + +=cut + +__PACKAGE__->add_columns( + "alias_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "vendor_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "alias", + { data_type => "varchar", is_nullable => 0, size => 255 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("alias_id"); + +=head1 RELATIONS + +=head2 vendor + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "vendor", + "Koha::Schema::Result::Aqbookseller", + { id => "vendor_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-20 18:19:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FmrIDHGkX2A+3aFZV2FZCA + +sub koha_object_class { + 'Koha::Acquisition::Bookseller::Alias'; +} +sub koha_objects_class { + 'Koha::Acquisition::Bookseller::Aliases'; +} + +1; -- 2.39.5