# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
-$VERSION = "19.12.00.070";
+$VERSION = "19.12.00.071";
sub version {
return $VERSION;
+++ /dev/null
-$DBversion = 'XXX'; # will be replaced by the RM
-if( CheckVersion( $DBversion ) ) {
- unless ( index_exists('authorised_values', 'av_uniq') ) {
- $dbh->do(q|
- DELETE FROM authorised_values
- WHERE category="COUNTRY" AND authorised_value="CC" AND lib="Keeling"
- |);
- my $duplicates = $dbh->selectall_arrayref(q|
- SELECT category, authorised_value, COUNT(concat(category, ':', authorised_value)) AS c
- FROM authorised_values
- GROUP BY category, authorised_value
- HAVING c > 1
- |, { Slice => {} });
- if ( @$duplicates ) {
- warn "WARNING - Cannot create unique constraint on authorised_value(category, authorised_value)\n";
- warn "The following entries are duplicated: " . join (', ', map { sprintf "%s:%s (%s)", $_->{category}, $_->{authorised_value}, $_->{c} } @$duplicates);
- } else {
- $dbh->do( q{ALTER TABLE `authorised_values` ADD CONSTRAINT `av_uniq` UNIQUE (category, authorised_value)} );
- }
- }
-
- SetVersion( $DBversion );
- print "Upgrade to $DBversion done (Bug 22887 - Add unique constraint to authorised_values)\n";
-}
NewVersion( $DBversion, 22774, "Limit purchase suggestion in a specified time period");
}
+$DBversion = '19.12.00.071';
+if( CheckVersion( $DBversion ) ) {
+ my @description = ("Add unique constraint to authorised_values");
+ unless ( index_exists('authorised_values', 'av_uniq') ) {
+ $dbh->do(q|
+ DELETE FROM authorised_values
+ WHERE category="COUNTRY" AND authorised_value="CC" AND lib="Keeling"
+ |);
+ my $duplicates = $dbh->selectall_arrayref(q|
+ SELECT category, authorised_value, COUNT(concat(category, ':', authorised_value)) AS c
+ FROM authorised_values
+ GROUP BY category, authorised_value
+ HAVING c > 1
+ |, { Slice => {} });
+ if ( @$duplicates ) {
+ push @description, "WARNING - Cannot create unique constraint on authorised_value(category, authorised_value)";
+ push @description, "The following entries are duplicated: " . join(
+ ', ',
+ map {
+ sprintf "%s:%s (%s)", $_->{category},
+ $_->{authorised_value}, $_->{c}
+ } @$duplicates
+ );
+ for my $error (@description) {
+ warn $error . "\n";
+ }
+ } else {
+ $dbh->do( q{ALTER TABLE `authorised_values` ADD CONSTRAINT `av_uniq` UNIQUE (category, authorised_value)} );
+ }
+ }
+
+ NewVersion( $DBversion, 22887, \@description );
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';