Bug 13757: (QA followup) Check DB structure before altering table
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 20 Jan 2017 13:59:27 +0000 (10:59 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 24 Mar 2017 18:45:07 +0000 (18:45 +0000)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.perl [new file with mode: 0644]
installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.sql [deleted file]

diff --git a/installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.perl b/installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.perl
new file mode 100644 (file)
index 0000000..1477763
--- /dev/null
@@ -0,0 +1,13 @@
+$DBversion = "16.12.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    unless ( column_exists( 'borrower_attribute_types', 'opac_editable' ) )
+    {
+        $dbh->do(q{
+            ALTER TABLE borrower_attribute_types
+                ADD COLUMN `opac_editable` tinyint(1) NOT NULL default 0 AFTER `opac_display`
+        });
+    }
+
+    print "Upgrade to $DBversion done (Bug 13757: Make patron attributes editable in the opac if set to 'editable in OPAC'\n";
+    SetVersion($DBversion);
+}
diff --git a/installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.sql b/installer/data/mysql/atomicupdate/bug_13757-add_opac_editable_to_borrower_attribute_types.sql
deleted file mode 100644 (file)
index 76a989f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE borrower_attribute_types ADD COLUMN `opac_editable` tinyint(1) NOT NULL default 0 AFTER `opac_display`;