Bug 20568: DBRev 17.12.00.043

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-05-08 16:06:22 -03:00
parent 2a8c3fad0a
commit ef7a900742
3 changed files with 27 additions and 26 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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.