@@ -, +, @@ values table. --- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -104,6 +104,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`) --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7953,6 +7953,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.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) --