From 5e3e75f1231cbe8bea5e97869e0d83505a168951 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Mar 2023 11:06:46 +0100 Subject: [PATCH] Bug 33103: DB changes Signed-off-by: Jonathan Field Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_33103.pl | 22 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 16 ++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_33103.pl diff --git a/installer/data/mysql/atomicupdate/bug_33103.pl b/installer/data/mysql/atomicupdate/bug_33103.pl new file mode 100755 index 0000000000..2db6e9a8d2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33103.pl @@ -0,0 +1,22 @@ +use Modern::Perl; + +return { + bug_number => "33103", + description => "Add vendor aliases", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless ( TableExists('aqbookseller_aliases') ) { + $dbh->do(q{ + CREATE TABLE `aqbookseller_aliases` ( + `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor', + `alias` varchar(255) NOT NULL COMMENT "the alias", + PRIMARY KEY (`alias_id`), + CONSTRAINT `aqbookseller_aliases_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + say $out "Added new table 'aqbookseller_aliases'"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index cba889d5e0..e92ffc1121 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -424,6 +424,22 @@ CREATE TABLE `aqbooksellers` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `aqbookseller_aliases` +-- + +DROP TABLE IF EXISTS `aqbookseller_aliases`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `aqbookseller_aliases` ( + `alias_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor', + `alias` varchar(255) NOT NULL COMMENT "the alias", + PRIMARY KEY (`alias_id`), + CONSTRAINT `aqbookseller_aliases_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`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 `aqbudgetborrowers` -- -- 2.39.5