From a1cd243d9d652769f51674dec6879b3b25f0619e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 2 Oct 2020 13:26:41 +0000 Subject: [PATCH] Bug 22343: DBRev 20.06.00.044 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../atomicupdate/bug_22343_smtp_servers.perl | 47 ------------------- installer/data/mysql/updatedatabase.pl | 47 +++++++++++++++++++ 3 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_22343_smtp_servers.perl diff --git a/Koha.pm b/Koha.pm index b6bb0b0e0d..c9b43e5aa3 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "20.06.00.043"; +$VERSION = "20.06.00.044"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_22343_smtp_servers.perl b/installer/data/mysql/atomicupdate/bug_22343_smtp_servers.perl deleted file mode 100644 index 58e747e5a1..0000000000 --- a/installer/data/mysql/atomicupdate/bug_22343_smtp_servers.perl +++ /dev/null @@ -1,47 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - - unless (TableExists('smtp_servers')) { - - # Create the table - $dbh->do(q{ - CREATE TABLE `smtp_servers` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `name` VARCHAR(80) NOT NULL, - `host` VARCHAR(80) NOT NULL DEFAULT 'localhost', - `port` INT(11) NOT NULL DEFAULT 25, - `timeout` INT(11) NOT NULL DEFAULT 120, - `ssl_mode` ENUM('disabled', 'ssl', 'starttls') NOT NULL, - `user_name` VARCHAR(80) NULL DEFAULT NULL, - `password` VARCHAR(80) NULL DEFAULT NULL, - `debug` TINYINT(1) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`), - KEY `host_idx` (`host`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - unless (TableExists('library_smtp_servers')) { - $dbh->do(q{ - CREATE TABLE `library_smtp_servers` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `library_id` VARCHAR(10) NOT NULL, - `smtp_server_id` INT(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `library_id_idx` (`library_id`), - KEY `smtp_server_id_idx` (`smtp_server_id`), - CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - $dbh->do(q{ - INSERT IGNORE INTO permissions - (module_bit, code, description) - VALUES ( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'); - }); - - # Always end with this (adjust the bug info) - NewVersion( $DBversion, 22343, "Add SMTP configuration options"); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 63a54c2114..39847fd9b2 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22876,6 +22876,53 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 25261, "Add CircConfirmItemParts syspref"); } +$DBversion = '20.06.00.044'; +if( CheckVersion( $DBversion ) ) { + + unless (TableExists('smtp_servers')) { + + # Create the table + $dbh->do(q{ + CREATE TABLE `smtp_servers` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(80) NOT NULL, + `host` VARCHAR(80) NOT NULL DEFAULT 'localhost', + `port` INT(11) NOT NULL DEFAULT 25, + `timeout` INT(11) NOT NULL DEFAULT 120, + `ssl_mode` ENUM('disabled', 'ssl', 'starttls') NOT NULL, + `user_name` VARCHAR(80) NULL DEFAULT NULL, + `password` VARCHAR(80) NULL DEFAULT NULL, + `debug` TINYINT(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `host_idx` (`host`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + unless (TableExists('library_smtp_servers')) { + $dbh->do(q{ + CREATE TABLE `library_smtp_servers` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `library_id` VARCHAR(10) NOT NULL, + `smtp_server_id` INT(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `library_id_idx` (`library_id`), + KEY `smtp_server_id_idx` (`smtp_server_id`), + CONSTRAINT `library_smtp_servers_library_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `library_smtp_servers_smtp_servers_fk` FOREIGN KEY (`smtp_server_id`) REFERENCES `smtp_servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + $dbh->do(q{ + INSERT IGNORE INTO permissions + (module_bit, code, description) + VALUES ( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'); + }); + + NewVersion( $DBversion, 22343, "Add SMTP configuration options"); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5