From 394d95d144aa58865b33d619753a12df352851eb Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Mon, 15 May 2017 11:41:00 +0000 Subject: [PATCH] Bug 18606: Schema changes --- Koha/Schema/Result/Collection.pm | 19 +++++++++-- Koha/Schema/Result/CollectionsTracking.pm | 54 +++++++++++++++++++++++++++---- Koha/Schema/Result/Item.pm | 19 +++++++++-- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/Koha/Schema/Result/Collection.pm b/Koha/Schema/Result/Collection.pm index 38353ea3dc..c4f2259ce5 100644 --- a/Koha/Schema/Result/Collection.pm +++ b/Koha/Schema/Result/Collection.pm @@ -116,9 +116,24 @@ __PACKAGE__->belongs_to( }, ); +=head2 collections_trackings -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-11-06 15:26:36 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gb7EYny5ULsZw8rYQQ/hjA +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "collections_trackings", + "Koha::Schema::Result::CollectionsTracking", + { "foreign.colId" => "self.colId" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-15 11:37:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nMkFfhk7kPuhbW70EE3pgg # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/CollectionsTracking.pm b/Koha/Schema/Result/CollectionsTracking.pm index 4a55cbdf37..086d0d9468 100644 --- a/Koha/Schema/Result/CollectionsTracking.pm +++ b/Koha/Schema/Result/CollectionsTracking.pm @@ -34,6 +34,7 @@ __PACKAGE__->table("collections_tracking"); accessor: 'col_id' data_type: 'integer' default_value: 0 + is_foreign_key: 1 is_nullable: 0 collections.colId @@ -42,6 +43,7 @@ collections.colId data_type: 'integer' default_value: 0 + is_foreign_key: 1 is_nullable: 0 items.itemnumber @@ -53,13 +55,19 @@ __PACKAGE__->add_columns( { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "colId", { - accessor => "col_id", - data_type => "integer", - default_value => 0, - is_nullable => 0, + accessor => "col_id", + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, }, "itemnumber", - { data_type => "integer", default_value => 0, is_nullable => 0 }, + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, ); =head1 PRIMARY KEY @@ -74,9 +82,41 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("collections_tracking_id"); +=head1 RELATIONS + +=head2 col + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "col", + "Koha::Schema::Result::Collection", + { colId => "colId" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=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" }, +); + -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-18 13:01:05 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:s8ZFSmMJt313bz3XdlhITQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-15 11:37:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f69L8B7r/Rvyn0AZQbrJcw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index ce85bd7b72..7f43d35e1a 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -499,6 +499,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 collections_trackings + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "collections_trackings", + "Koha::Schema::Result::CollectionsTracking", + { "foreign.itemnumber" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 course_item Type: might_have @@ -675,8 +690,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vf1sBZrpUo0Cvi896fjNuA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-05-15 11:37:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OUa2zlinnT3CbZgH/yGNPA __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); -- 2.11.0