From 3ea21d310b3cfb99d4eed56a80a11747e16c1ba7 Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Sun, 30 Apr 2023 21:31:44 +0000
Subject: [PATCH] Bug 30928: (QA follow-up) DB updates

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
---
 installer/data/mysql/atomicupdate/bug_30928.pl | 18 ++++++++++++++++++
 installer/data/mysql/kohastructure.sql         |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 installer/data/mysql/atomicupdate/bug_30928.pl

diff --git a/installer/data/mysql/atomicupdate/bug_30928.pl b/installer/data/mysql/atomicupdate/bug_30928.pl
new file mode 100644
index 00000000000..726c9c2452f
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_30928.pl
@@ -0,0 +1,18 @@
+use Modern::Perl;
+return {
+    bug_number => "30928",
+    description => "Add interface field to statistics table",
+    up => sub {
+        my ($args) = @_;
+        my ($dbh, $out) = @$args{qw(dbh out)};
+        if( !column_exists( 'statistics', 'interface' ) ) {
+            $dbh->do(q{
+                ALTER TABLE statistics
+                ADD COLUMN interface varchar(30) NULL DEFAULT NULL
+                COMMENT "interface"
+                AFTER categorycode
+            });
+            say $out "Added column 'statistics.interface'";
+        }
+    },
+}
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 50796112dcf..454a00d7754 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -5360,6 +5360,7 @@ CREATE TABLE `statistics` (
   `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower',
   `ccode` varchar(80) DEFAULT NULL COMMENT 'foreign key from the items table, links transaction to a specific collection code',
   `categorycode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the borrowers table, links transaction to a specific borrower category',
+  `interface` varchar(30) DEFAULT NULL COMMENT 'the context this action was taken in',
   KEY `timeidx` (`datetime`),
   KEY `branch_idx` (`branch`),
   KEY `type_idx` (`type`),
-- 
2.30.2