From 39e8fd30d73f804054bb2fe42441abb445a73bfc Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 26 Mar 2020 15:51:54 +0000 Subject: [PATCH] Bug 13881: (RM followup) Fix incorrect idempotency test Signed-off-by: Martin Renvoize --- installer/data/mysql/updatedatabase.pl | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9f45a85ad1..16f61d15ee 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21273,16 +21273,19 @@ if( CheckVersion( $DBversion ) ) { $DBversion = '19.12.00.054'; if( CheckVersion( $DBversion ) ) { - $dbh->do(qq{ - CREATE TABLE IF NOT EXISTS `desks` ( -- desks available in a library - `desk_id` int(11) NOT NULL auto_increment, -- unique identifier added by Koha - `desk_name` varchar(100) NOT NULL default '', -- name of the desk - `branchcode` varchar(10) NOT NULL, -- library the desk is located at - PRIMARY KEY (`desk_id`), - KEY `fk_desks_branchcode` (`branchcode`), - CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); + + if ( !TableExists('desks') ) { + $dbh->do(qq{ + CREATE TABLE `desks` ( -- desks available in a library + `desk_id` int(11) NOT NULL auto_increment, -- unique identifier added by Koha + `desk_name` varchar(100) NOT NULL default '', -- name of the desk + `branchcode` varchar(10) NOT NULL, -- library the desk is located at + PRIMARY KEY (`desk_id`), + KEY `fk_desks_branchcode` (`branchcode`), + CONSTRAINT `fk_desks_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } NewVersion( $DBversion, 13881, "Add desk management"); } -- 2.39.5