Bug 22564: Add database update 'just in case'
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 29 Mar 2019 12:20:26 +0000 (12:20 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 19 Apr 2019 14:48:28 +0000 (14:48 +0000)
With the introduction of the 'status' field it's a clear oportunity to
convert any last remaining instances of 'Rep' to 'L' + 'REPLACED'.

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

installer/data/mysql/atomicupdate/bug_22564.perl [new file with mode: 0644]

diff --git a/installer/data/mysql/atomicupdate/bug_22564.perl b/installer/data/mysql/atomicupdate/bug_22564.perl
new file mode 100644 (file)
index 0000000..0407ac8
--- /dev/null
@@ -0,0 +1,17 @@
+$DBversion = 'XXX';    # will be replaced by the RM
+if ( CheckVersion($DBversion) ) {
+
+    my $rows = $dbh->do(
+        qq{
+        UPDATE `accountlines`
+        SET
+          `accounttype` = 'L',
+          `status`      = 'REPLACED'
+        WHERE
+          `accounttype` = 'Rep'
+      }
+    );
+
+    SetVersion($DBversion);
+    printf "Upgrade to $DBversion done (Bug 22564 - Fix accounttype 'O' to 'FU' - %d updated)\n", $rows;
+}