From 4ad136ff0fec4b4e2e3a536b32c4d7297936a48f 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 --- .../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..cd06f7835b --- /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` ( + `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 (`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 03dd4766de..4140a6f249 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -423,6 +423,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` ( + `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 (`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.30.2