From 5337a0fa8ef99ce67627cae16578965cb3122c53 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 8 Sep 2015 12:54:35 +1000 Subject: [PATCH] Bug 10662 - DBIx::Class ResultSets for Testing This patch adds the DBIx::Class ResultSets for testing. These are necessary in order for the main OAI-PMH harvester patch to work. --- Koha/Schema/Result/OaiHarvest.pm | 180 +++++++++++++++++++++++ Koha/Schema/Result/OaiHarvestRepository.pm | 223 +++++++++++++++++++++++++++++ 2 files changed, 403 insertions(+) create mode 100755 Koha/Schema/Result/OaiHarvest.pm create mode 100755 Koha/Schema/Result/OaiHarvestRepository.pm diff --git a/Koha/Schema/Result/OaiHarvest.pm b/Koha/Schema/Result/OaiHarvest.pm new file mode 100755 index 0000000..85b6ede --- /dev/null +++ b/Koha/Schema/Result/OaiHarvest.pm @@ -0,0 +1,180 @@ +use utf8; +package Koha::Schema::Result::OaiHarvest; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::OaiHarvest + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("oai_harvest"); + +=head1 ACCESSORS + +=head2 oai_harvest_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 repository_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 system_number + + data_type: 'integer' + is_nullable: 1 + +=head2 action + + data_type: 'varchar' + is_nullable: 1 + size: 45 + +=head2 timestamp + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=head2 identifier + + data_type: 'varchar' + is_nullable: 0 + size: 255 + +=head2 datestamp + + data_type: 'varchar' + is_nullable: 0 + size: 45 + +=head2 metadata_prefix + + data_type: 'varchar' + is_nullable: 0 + size: 45 + +=head2 metadata + + data_type: 'longtext' + is_nullable: 1 + +=head2 record_type + + data_type: 'enum' + default_value: 'biblio' + extra: {list => ["biblio","auth","holdings"]} + is_nullable: 0 + +=head2 original_system_number + + data_type: 'varchar' + is_nullable: 1 + size: 45 + +=cut + +__PACKAGE__->add_columns( + "oai_harvest_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "repository_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "system_number", + { data_type => "integer", is_nullable => 1 }, + "action", + { data_type => "varchar", is_nullable => 1, size => 45 }, + "timestamp", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "identifier", + { data_type => "varchar", is_nullable => 0, size => 255 }, + "datestamp", + { data_type => "varchar", is_nullable => 0, size => 45 }, + "metadata_prefix", + { data_type => "varchar", is_nullable => 0, size => 45 }, + "metadata", + { data_type => "longtext", is_nullable => 1 }, + "record_type", + { + data_type => "enum", + default_value => "biblio", + extra => { list => ["biblio", "auth", "holdings"] }, + is_nullable => 0, + }, + "original_system_number", + { data_type => "varchar", is_nullable => 1, size => 45 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("oai_harvest_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("harvest_identifier_datestamp", ["identifier", "datestamp"]); + +=head1 RELATIONS + +=head2 repository + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "repository", + "Koha::Schema::Result::OaiHarvestRepository", + { repository_id => "repository_id" }, + { is_deferrable => 1, on_delete => "RESTRICT", on_update => "NO ACTION" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-18 11:54:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MeU+dn+S+ynl/VOAVe0elA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/OaiHarvestRepository.pm b/Koha/Schema/Result/OaiHarvestRepository.pm new file mode 100755 index 0000000..6d7dbec --- /dev/null +++ b/Koha/Schema/Result/OaiHarvestRepository.pm @@ -0,0 +1,223 @@ +use utf8; +package Koha::Schema::Result::OaiHarvestRepository; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::OaiHarvestRepository + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("oai_harvest_repositories"); + +=head1 ACCESSORS + +=head2 repository_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 base_url + + data_type: 'text' + is_nullable: 0 + +=head2 basic_username + + data_type: 'text' + is_nullable: 1 + +=head2 basic_password + + data_type: 'text' + is_nullable: 1 + +=head2 basic_realm + + data_type: 'text' + is_nullable: 1 + +=head2 datetime_granularity + + data_type: 'enum' + default_value: 'YYYY-MM-DD' + extra: {list => ["YYYY-MM-DDThh:mm:ssZ","YYYY-MM-DD"]} + is_nullable: 0 + +=head2 opt_from + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 opt_until + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 opt_set + + data_type: 'varchar' + is_nullable: 1 + size: 45 + +=head2 metadata_prefix + + data_type: 'varchar' + is_nullable: 0 + size: 45 + +=head2 active + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=head2 timestamp + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=head2 xslt_path + + data_type: 'text' + is_nullable: 1 + +=head2 frameworkcode + + data_type: 'varchar' + default_value: (empty string) + is_nullable: 0 + size: 4 + +=head2 comments + + data_type: 'text' + is_nullable: 1 + +=head2 record_type + + data_type: 'enum' + default_value: 'biblio' + extra: {list => ["biblio","auth","holdings"]} + is_nullable: 0 + +=head2 original_system_field + + data_type: 'varchar' + is_nullable: 1 + size: 45 + +=cut + +__PACKAGE__->add_columns( + "repository_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "base_url", + { data_type => "text", is_nullable => 0 }, + "basic_username", + { data_type => "text", is_nullable => 1 }, + "basic_password", + { data_type => "text", is_nullable => 1 }, + "basic_realm", + { data_type => "text", is_nullable => 1 }, + "datetime_granularity", + { + data_type => "enum", + default_value => "YYYY-MM-DD", + extra => { list => ["YYYY-MM-DDThh:mm:ssZ", "YYYY-MM-DD"] }, + is_nullable => 0, + }, + "opt_from", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "opt_until", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "opt_set", + { data_type => "varchar", is_nullable => 1, size => 45 }, + "metadata_prefix", + { data_type => "varchar", is_nullable => 0, size => 45 }, + "active", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "timestamp", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "xslt_path", + { data_type => "text", is_nullable => 1 }, + "frameworkcode", + { data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, + "comments", + { data_type => "text", is_nullable => 1 }, + "record_type", + { + data_type => "enum", + default_value => "biblio", + extra => { list => ["biblio", "auth", "holdings"] }, + is_nullable => 0, + }, + "original_system_field", + { data_type => "varchar", is_nullable => 1, size => 45 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("repository_id"); + +=head1 RELATIONS + +=head2 oai_harvests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "oai_harvests", + "Koha::Schema::Result::OaiHarvest", + { "foreign.repository_id" => "self.repository_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2015-08-18 11:54:57 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EX+ru6uCSB83y41RHERfhw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.1.4