From ef7a900742cf8c7bc063cc6df74b922db235b8b6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 8 May 2018 16:06:22 -0300 Subject: [PATCH] Bug 20568: DBRev 17.12.00.043 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../atomicupdate/bug_20568_api_keys.perl | 25 ------------------ installer/data/mysql/updatedatabase.pl | 26 +++++++++++++++++++ 3 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_20568_api_keys.perl diff --git a/Koha.pm b/Koha.pm index e7a4bc890a..60e80b2055 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 = "17.12.00.042"; +$VERSION = "17.12.00.043"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_20568_api_keys.perl b/installer/data/mysql/atomicupdate/bug_20568_api_keys.perl deleted file mode 100644 index 0267f35991..0000000000 --- a/installer/data/mysql/atomicupdate/bug_20568_api_keys.perl +++ /dev/null @@ -1,25 +0,0 @@ -$DBversion = "XXX"; -if(CheckVersion($DBversion)) { - - if (!TableExists('api_keys')) { - $dbh->do(q{ - CREATE TABLE `api_keys` ( - `client_id` VARCHAR(191) NOT NULL, - `secret` VARCHAR(191) NOT NULL, - `description` VARCHAR(255) NOT NULL, - `patron_id` INT(11) NOT NULL, - `active` TINYINT(1) DEFAULT 1 NOT NULL, - PRIMARY KEY `client_id` (`client_id`), - UNIQUE KEY `secret` (`secret`), - KEY `patron_id` (`patron_id`), - CONSTRAINT `api_keys_fk_patron_id` - FOREIGN KEY (`patron_id`) - REFERENCES `borrowers` (`borrowernumber`) - ON DELETE CASCADE ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - print "Upgrade to $DBversion done (Bug 20568 - Add API key management interface for patrons)\n"; - SetVersion($DBversion); -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9a7e635e20..32229b92fe 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16010,6 +16010,32 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 20402 - Implement OAuth2 authentication for REST API)\n"; } +$DBversion = '17.12.00.043'; +if(CheckVersion($DBversion)) { + + if (!TableExists('api_keys')) { + $dbh->do(q{ + CREATE TABLE `api_keys` ( + `client_id` VARCHAR(191) NOT NULL, + `secret` VARCHAR(191) NOT NULL, + `description` VARCHAR(255) NOT NULL, + `patron_id` INT(11) NOT NULL, + `active` TINYINT(1) DEFAULT 1 NOT NULL, + PRIMARY KEY `client_id` (`client_id`), + UNIQUE KEY `secret` (`secret`), + KEY `patron_id` (`patron_id`), + CONSTRAINT `api_keys_fk_patron_id` + FOREIGN KEY (`patron_id`) + REFERENCES `borrowers` (`borrowernumber`) + ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + print "Upgrade to $DBversion done (Bug 20568 - Add API key management interface for patrons)\n"; + SetVersion($DBversion); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5