From 7ef1b10512215a11a19a1b8e1006c3940f397e25 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 17 Apr 2018 16:46:19 +0100 Subject: [PATCH] Bug 11897: DO NOT PUSH: (follow-up) Update stock rotation schema files. We we're missing a unique constraint on stockrationrota.title --- Koha/Schema/Result/Branch.pm | 4 ++-- Koha/Schema/Result/Item.pm | 5 ++--- Koha/Schema/Result/Stockrotationrota.pm | 18 ++++++++++++++++-- installer/data/mysql/atomicupdate/stockrot_tables.sql | 4 +++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 1f2bcb4c73..fceb86b672 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -624,8 +624,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QOMUFz2EjvAVWCkIpNmvtg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0hfhEZW9VseBN7k05ByvpQ # 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 bc439c7ef8..027075e9c4 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -702,8 +702,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 17:02:24 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oo/Eubwpc1tcaGAO9Oja1A +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:aOcn/Am4XilK4NblfY5zXQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); @@ -728,5 +728,4 @@ sub effective_itemtype { } } -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/Koha/Schema/Result/Stockrotationrota.pm b/Koha/Schema/Result/Stockrotationrota.pm index 46661c635f..48f401df32 100644 --- a/Koha/Schema/Result/Stockrotationrota.pm +++ b/Koha/Schema/Result/Stockrotationrota.pm @@ -79,6 +79,20 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("rota_id"); +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("stockrotationrotas_title", ["title"]); + =head1 RELATIONS =head2 stockrotationstages @@ -97,8 +111,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-17 16:18:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gglRP/Dh1RIu9eH834lStA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-04-17 16:37:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KOv8PNKzQd3gLTskL1GiHw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/stockrot_tables.sql b/installer/data/mysql/atomicupdate/stockrot_tables.sql index cbbb5c5976..8ca89a0c6b 100644 --- a/installer/data/mysql/atomicupdate/stockrot_tables.sql +++ b/installer/data/mysql/atomicupdate/stockrot_tables.sql @@ -6,7 +6,9 @@ CREATE TABLE IF NOT EXISTS stockrotationrotas ( description text NOT NULL default '', -- Description for this rota cyclical tinyint(1) NOT NULL default 0, -- Should items on this rota keep cycling? active tinyint(1) NOT NULL default 0, -- Is this rota currently active? - PRIMARY KEY (`rota_id`) + PRIMARY KEY (`rota_id`), + CONSTRAINT `stockrotationrotas_title` + UNIQUE (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Stock Rotation Stages -- 2.14.2