From 08343b0e42a629a50284df56244c824478688fed Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Tue, 25 Feb 2020 09:42:20 +0000
Subject: [PATCH] Bug 22821: Add reply_address field to message_queue table

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
---
 installer/data/mysql/atomicupdate/bug_22821.perl | 9 +++++++++
 installer/data/mysql/kohastructure.sql           | 1 +
 2 files changed, 10 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_22821.perl

diff --git a/installer/data/mysql/atomicupdate/bug_22821.perl b/installer/data/mysql/atomicupdate/bug_22821.perl
new file mode 100644
index 0000000000..0d52232169
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_22821.perl
@@ -0,0 +1,9 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    if (!column_exists('message_queue', 'reply_address')) {
+        $dbh->do('ALTER TABLE message_queue ADD COLUMN reply_address LONGTEXT AFTER from_address');
+    }
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 22821 - Add reply_address to message_queue)\n";
+}
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 8ec1791c66..22497c2ae7 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2394,6 +2394,7 @@ CREATE TABLE `message_queue` (
   `updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `to_address` LONGTEXT,
   `from_address` LONGTEXT,
+  `reply_address` LONGTEXT,
   `content_type` MEDIUMTEXT,
   PRIMARY KEY `message_id` (`message_id`),
   KEY `borrowernumber` (`borrowernumber`),
-- 
2.11.0