Bug 20487: (QA follow-up) Requested db revision
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 31 May 2018 07:02:12 +0000 (09:02 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 24 Aug 2018 11:41:04 +0000 (12:41 +0100)
As requested in comment12, we can update these cases in a dbrev too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Checked out item, deleted issue record, ran dbrev.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 74cc24d227835ee822707dd808382371f1a6bae8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

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

diff --git a/installer/data/mysql/atomicupdate/bug_20487.perl b/installer/data/mysql/atomicupdate/bug_20487.perl
new file mode 100644 (file)
index 0000000..553fd6b
--- /dev/null
@@ -0,0 +1,12 @@
+$DBversion = 'XXX';  # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( q|
+UPDATE items LEFT JOIN issues USING (itemnumber)
+SET items.onloan = NULL
+WHERE issues.itemnumber IS NULL
+    |);
+
+    # Always end with this (adjust the bug info)
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 20487: Clear items.onloan for unissued items)\n";
+}