Bug 13790 [QA Followup] - Disable auto increment on old_issues after pk values are...
[koha-ffzg.git] / installer / data / mysql / updatedatabase.pl
index 991b7b0..ec7005e 100755 (executable)
@@ -10154,26 +10154,17 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
-# DEVELOPER PROCESS, search for anything to execute in the db_update directory
-# 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/';
-opendir( my $dirh, $update_dir );
-while ( my $file = readdir $dirh ) {
-    next unless $file =~ /\.sql$/;    # skip non SQL files
-    print "DEV atomic update : $file \n";
-    my $installer = C4::Installer->new();
-    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
-}
-
-$DBversion = "XXX";
+$DBversion = "3.19.00.XXX";
 if(CheckVersion($DBversion)) {
     $dbh->do(q{
         ALTER TABLE old_issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
     });
 
     $dbh->do(q{
+        ALTER TABLE old_issues CHANGE issue_id issue_id INT( 11 ) NOT NULL
+    });
+
+    $dbh->do(q{
         ALTER TABLE issues ADD issue_id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST
     });
 
@@ -10191,7 +10182,20 @@ if(CheckVersion($DBversion)) {
 
     print "Upgrade to $DBversion done (Bug 13790 - Add unique id issue_id to issues and oldissues tables)\n";
     SetVersion($DBversion);
+}
+
+
+# DEVELOPER PROCESS, search for anything to execute in the db_update directory
+# 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/';
+opendir( my $dirh, $update_dir );
+while ( my $file = readdir $dirh ) {
+    next unless $file =~ /\.sql$/;    # skip non SQL files
+    print "DEV atomic update : $file \n";
+    my $installer = C4::Installer->new();
+    my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
 }
 
 =head1 FUNCTIONS