From 4df775f4f9ce92a629bf5611be9f9e8946c1316a Mon Sep 17 00:00:00 2001 From: Marion Durand Date: Tue, 18 Jan 2022 15:39:03 +0100 Subject: [PATCH] Bug 18618: Update database create the atomicupdate file --- .../bug_18618-add_table_reading_pairs.pl | 28 +++++++++++++++++++ .../mana_add_table_reading_pairs.sql | 16 ----------- installer/data/mysql/kohastructure.sql | 20 +++++++++++++ 3 files changed, 48 insertions(+), 16 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_18618-add_table_reading_pairs.pl delete mode 100644 installer/data/mysql/atomicupdate/mana_add_table_reading_pairs.sql diff --git a/installer/data/mysql/atomicupdate/bug_18618-add_table_reading_pairs.pl b/installer/data/mysql/atomicupdate/bug_18618-add_table_reading_pairs.pl new file mode 100644 index 0000000000..f3860607a3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_18618-add_table_reading_pairs.pl @@ -0,0 +1,28 @@ +use Modern::Perl; + +return { + bug_number => "18618", + description => "Add new table reading_suggestions", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Creating a column by suggestion is a design choice made to maximise speed + $dbh->do(q{ + CREATE TABLE IF NOT EXISTS `reading_suggestion` ( + `biblionumber` int(11) NOT NULL, + `biblionumber1` int(11) NOT NULL, + `biblionumber2` int(11) DEFAULT NULL, + `biblionumber3` int(11) DEFAULT NULL, + `biblionumber4` int(11) DEFAULT NULL, + `biblionumber5` int(11) DEFAULT NULL, + `biblionumber6` int(11) DEFAULT NULL, + `biblionumber7` int(11) DEFAULT NULL, + `biblionumber8` int(11) DEFAULT NULL, + `biblionumber9` int(11) DEFAULT NULL, + `biblionumber10` int(11) DEFAULT NULL, + `timestamp` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`biblionumber`) + ) + }); + }, +}; diff --git a/installer/data/mysql/atomicupdate/mana_add_table_reading_pairs.sql b/installer/data/mysql/atomicupdate/mana_add_table_reading_pairs.sql deleted file mode 100644 index eea656d0e5..0000000000 --- a/installer/data/mysql/atomicupdate/mana_add_table_reading_pairs.sql +++ /dev/null @@ -1,16 +0,0 @@ --- biblionumber1 not null otherwise the data is useless -CREATE TABLE `reading_suggestion` ( - `biblionumber` int(11) NOT NULL, - `biblionumber1` int(11) NOT NULL, - `biblionumber2` int(11) DEFAULT NULL, - `biblionumber3` int(11) DEFAULT NULL, - `biblionumber4` int(11) DEFAULT NULL, - `biblionumber5` int(11) DEFAULT NULL, - `biblionumber6` int(11) DEFAULT NULL, - `biblionumber7` int(11) DEFAULT NULL, - `biblionumber8` int(11) DEFAULT NULL, - `biblionumber9` int(11) DEFAULT NULL, - `biblionumber10` int(11) DEFAULT NULL, - `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`biblionumber`) -); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0aab2ff94e..24cc12f158 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5361,6 +5361,26 @@ CREATE TABLE `zebraqueue` ( /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; +DROP TABLE IF EXISTS `reading_suggestion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `reading_suggestion` ( + `biblionumber` int(11) NOT NULL, + `biblionumber1` int(11) NOT NULL, + `biblionumber2` int(11) DEFAULT NULL, + `biblionumber3` int(11) DEFAULT NULL, + `biblionumber4` int(11) DEFAULT NULL, + `biblionumber5` int(11) DEFAULT NULL, + `biblionumber6` int(11) DEFAULT NULL, + `biblionumber7` int(11) DEFAULT NULL, + `biblionumber8` int(11) DEFAULT NULL, + `biblionumber9` int(11) DEFAULT NULL, + `biblionumber10` int(11) DEFAULT NULL, + `timestamp` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`biblionumber`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -- 2.17.1