Bug 17845: Update atomic update for new format
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 9 Mar 2020 16:41:27 +0000 (16:41 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 10 Mar 2020 15:18:27 +0000 (15:18 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
installer/data/mysql/atomicupdate/bug_17845.perl [new file with mode: 0644]
installer/data/mysql/atomicupdate/bug_17845_remove_printers [deleted file]

diff --git a/installer/data/mysql/atomicupdate/bug_17845.perl b/installer/data/mysql/atomicupdate/bug_17845.perl
new file mode 100644 (file)
index 0000000..375adc5
--- /dev/null
@@ -0,0 +1,13 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( "DROP TABLE IF EXISTS printers" );
+
+    if( !column_exists( 'branches', 'branchprinter' ) ) {
+      $dbh->do( "ALTER TABLE branches DROP COLUMN branchprinter" );
+    }
+
+    $dbh->do(qq{ DELETE FROM systempreferences WHERE variable = "printcirculationslips"} );
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 17845 - Drop unused table printers and branchprinter column)\n";
+}
diff --git a/installer/data/mysql/atomicupdate/bug_17845_remove_printers b/installer/data/mysql/atomicupdate/bug_17845_remove_printers
deleted file mode 100644 (file)
index 914860b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-DROP TABLE IF EXISTS printers;
-ALTER TABLE branches DROP COLUMN branchprinter;
-DELETE FROM systempreferences WHERE variable = "printcirculationslips";
--- Bug 17845: Drop unused table printers and branchprinter column