Bug 22729: DB update
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 17 Apr 2019 18:01:47 +0000 (15:01 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 25 Apr 2019 10:06:44 +0000 (10:06 +0000)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

installer/data/mysql/atomicupdate/bug_21336_followup.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql

diff --git a/installer/data/mysql/atomicupdate/bug_21336_followup.perl b/installer/data/mysql/atomicupdate/bug_21336_followup.perl
new file mode 100644 (file)
index 0000000..880d832
--- /dev/null
@@ -0,0 +1,20 @@
+$DBversion = 'XXX';
+if( CheckVersion( $DBversion ) ) {
+
+    if ( column_exists( 'borrowers', 'flgAnonymized' ) ) {
+        $dbh->do(q{
+            ALTER TABLE borrowers
+                CHANGE `flgAnonymized` `anonymized` TINYINT(1) NOT NULL DEFAULT 0
+        });
+    }
+
+    if ( column_exists( 'deletedborrowers', 'flgAnonymized' ) ) {
+        $dbh->do(q{
+            ALTER TABLE deletedborrowers
+                CHANGE `flgAnonymized` `anonymized` TINYINT(1) NOT NULL DEFAULT 0
+        });
+    }
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 21336 - (follow-up) Rename flgAnonymized column)\n";
+}
index 7b78a87..77224bc 100644 (file)
@@ -609,7 +609,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower
   `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
   `login_attempts` int(4) default 0, -- number of failed login attemps
   `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
-  `flgAnonymized` tinyint DEFAULT 0, -- flag for data anonymization
+  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
   KEY borrowernumber (borrowernumber),
   KEY `cardnumber` (`cardnumber`),
   KEY `sms_provider_id` (`sms_provider_id`)
@@ -1643,7 +1643,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
   `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron
   `login_attempts` int(4) default 0, -- number of failed login attemps
   `overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
-  `flgAnonymized` tinyint DEFAULT 0, -- flag for data anonymization
+  `anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
   UNIQUE KEY `cardnumber` (`cardnumber`),
   PRIMARY KEY `borrowernumber` (`borrowernumber`),
   KEY `categorycode` (`categorycode`),