Bug 22521: Increase varchar size for accounttype
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 19 Mar 2019 14:24:35 +0000 (14:24 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 17 Apr 2019 16:49:36 +0000 (16:49 +0000)
accountlines.accounttype is currently a short varchar(5) field for to
store accounttype codes. Koha is moving towards more descriptive codes
which require a larger capacity varchar(16).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

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

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

diff --git a/installer/data/mysql/atomicupdate/bug_22521.perl b/installer/data/mysql/atomicupdate/bug_22521.perl
new file mode 100644 (file)
index 0000000..d6d5acf
--- /dev/null
@@ -0,0 +1,16 @@
+$DBversion = 'XXX';    # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+    if ( column_exists( 'accountlines', 'accounttype' ) ) {
+        $dbh->do(
+            qq{
+            ALTER TABLE `accountlines`
+            CHANGE COLUMN `accounttype`
+              `accounttype` varchar(16) DEFAULT NULL;
+          }
+        );
+    }
+
+    SetVersion($DBversion);
+    print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16))\n";
+}
index b01fb66..8c60c99 100644 (file)
@@ -2680,7 +2680,7 @@ CREATE TABLE `accountlines` (
   `date` date default NULL,
   `amount` decimal(28,6) default NULL,
   `description` LONGTEXT,
-  `accounttype` varchar(5) default NULL,
+  `accounttype` varchar(16) default NULL,
   `status` varchar(16) default NULL,
   `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
   `amountoutstanding` decimal(28,6) default NULL,