Bug 20568: (QA follow-up) Remove api-key management from OPAC
[koha.git] / installer / data / mysql / atomicupdate / bug_20568_api_keys.perl
1 $DBversion = "XXX";
2 if(CheckVersion($DBversion)) {
3
4     if (!TableExists('api_keys')) {
5         $dbh->do(q{
6             CREATE TABLE `api_keys` (
7                 `client_id`   VARCHAR(191) NOT NULL,
8                 `secret`      VARCHAR(191) NOT NULL,
9                 `description` VARCHAR(255) NOT NULL,
10                 `patron_id`   INT(11) NOT NULL,
11                 `active`      TINYINT(1) DEFAULT 1 NOT NULL,
12                 PRIMARY KEY `client_id` (`client_id`),
13                 UNIQUE KEY `secret` (`secret`),
14                 KEY `patron_id` (`patron_id`),
15                 CONSTRAINT `api_keys_fk_patron_id`
16                   FOREIGN KEY (`patron_id`)
17                   REFERENCES `borrowers` (`borrowernumber`)
18                   ON DELETE CASCADE ON UPDATE CASCADE
19             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
20         });
21     }
22
23     print "Upgrade to $DBversion done (Bug 20568 - Add API key management interface for patrons)\n";
24     SetVersion($DBversion);
25 }