From f711456d8102f3d5b9b699d7f1a0eff215a39848 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 24 Mar 2020 12:56:41 -0400 Subject: [PATCH] Bug 24857: Add new Schema files Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Rebecca Coert --- Koha/Schema/Result/Volume.pm | 144 +++++++++++++++++++++++++++++++ Koha/Schema/Result/VolumeItem.pm | 122 ++++++++++++++++++++++++++ 2 files changed, 266 insertions(+) create mode 100644 Koha/Schema/Result/Volume.pm create mode 100644 Koha/Schema/Result/VolumeItem.pm diff --git a/Koha/Schema/Result/Volume.pm b/Koha/Schema/Result/Volume.pm new file mode 100644 index 0000000000..30388d165d --- /dev/null +++ b/Koha/Schema/Result/Volume.pm @@ -0,0 +1,144 @@ +use utf8; +package Koha::Schema::Result::Volume; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Volume + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("volumes"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 biblionumber + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +=head2 description + + data_type: 'mediumtext' + is_nullable: 1 + +=head2 created_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: '0000-00-00 00:00:00' + is_nullable: 0 + +=head2 updated_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "biblionumber", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "description", + { data_type => "mediumtext", is_nullable => 1 }, + "created_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => "0000-00-00 00:00:00", + is_nullable => 0, + }, + "updated_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 biblionumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblionumber", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 volume_items + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "volume_items", + "Koha::Schema::Result::VolumeItem", + { "foreign.volume_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-04 15:22:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cXvLM2TgY18pxE2ZJBMouw + +sub koha_objects_class { + 'Koha::Biblio::Volumes'; +} + +sub koha_object_class { + 'Koha::Biblio::Volume'; +} + +1; diff --git a/Koha/Schema/Result/VolumeItem.pm b/Koha/Schema/Result/VolumeItem.pm new file mode 100644 index 0000000000..3ce549209b --- /dev/null +++ b/Koha/Schema/Result/VolumeItem.pm @@ -0,0 +1,122 @@ +use utf8; +package Koha::Schema::Result::VolumeItem; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::VolumeItem + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("volume_items"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 volume_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +=head2 itemnumber + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "volume_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "itemnumber", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 itemnumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "itemnumber", + "Koha::Schema::Result::Item", + { itemnumber => "itemnumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 volume + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "volume", + "Koha::Schema::Result::Volume", + { id => "volume_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-03 18:25:20 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:i6YHB4Jq+79kVVYmuurzIQ + +sub koha_object_class { + 'Koha::Biblio::Volume::Item'; +} +sub koha_objects_class { + 'Koha::Biblio::Volume::Items'; +} + +1; -- 2.30.1 (Apple Git-130)