From 93d03b46e9106cb6f280cd7ae1c88e20f2a1cd30 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 19 Dec 2024 16:55:40 +0000 Subject: [PATCH] Bug 38689: Add edifact_errors table Signed-off-by: Kyle M Hall --- .../data/mysql/atomicupdate/bug_38689.pl | 31 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 19 ++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_38689.pl diff --git a/installer/data/mysql/atomicupdate/bug_38689.pl b/installer/data/mysql/atomicupdate/bug_38689.pl new file mode 100644 index 00000000000..d43953058a5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_38689.pl @@ -0,0 +1,31 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "38689", + description => "Add edifact_errors table to record edifact error messages", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !TableExists('edifact_errors') ) { + $dbh->do( + q{ + CREATE TABLE `edifact_errors` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `message_id` int(11) NOT NULL, + `date` date DEFAULT NULL, + `section` mediumtext DEFAULT NULL, + `details` mediumtext DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `messageid` (`message_id`), + CONSTRAINT `emfk_message` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + } + ); + say_success( $out, "Added new table 'edifect_errors'" ); + } else { + say_info( $out, "Table already exists" ); + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 3bf15c1007d..cfc81124192 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2903,6 +2903,25 @@ CREATE TABLE `edifact_messages` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `edifact_errors` +-- + +DROP TABLE IF EXISTS `edifact_errors`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `edifact_errors` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `message_id` int(11) NOT NULL, + `date` date DEFAULT NULL, + `section` mediumtext DEFAULT NULL, + `details` mediumtext DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `messageid` (`message_id`), + CONSTRAINT `emfk_message` FOREIGN KEY (`message_id`) REFERENCES `edifact_messages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `erm_agreement_licenses` -- -- 2.48.0