From 941042e9afcd610ba94f6caef4586e6025709e09 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 28 May 2013 16:09:41 +0200 Subject: [PATCH] Bug 10363: DB Changes: Adds a unique key for the authorised values table. Signed-off-by: Kyle M Hall --- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ca2f2b2..9c5ec04 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -103,6 +103,7 @@ CREATE TABLE `authorised_values` ( -- stores values for authorized values catego `lib_opac` varchar(200) default NULL, -- authorized value description as printed in the OPAC `imageurl` varchar(200) default NULL, -- authorized value URL PRIMARY KEY (`id`), + UNIQUE KEY `av_uniq` (`category`,`authorised_value`), KEY `name` (`category`), KEY `lib` (`lib`), KEY `auth_value_idx` (`authorised_value`) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f3a90d8..5df456e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6984,6 +6984,18 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( } + + + +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + ALTER TABLE authorised_values ADD UNIQUE KEY av_uniq(category, authorised_value); + }); + print "Upgrade to $DBversion done (Bug XXXXX: Add unique key on the authorised_values table)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.7.2.5