Lines 1-28
Link Here
|
1 |
$DBversion = "XXX"; |
1 |
$DBversion = "XXX"; |
2 |
if(CheckVersion($DBversion)) { |
2 |
if(CheckVersion($DBversion)) { |
3 |
|
3 |
|
4 |
$dbh->do(q{ |
4 |
if (!TableExists('oauth_access_tokens')) { |
5 |
DROP TABLE IF EXISTS api_keys; |
5 |
$dbh->do(q{ |
6 |
}); |
6 |
CREATE TABLE `api_keys` ( |
7 |
|
7 |
`id` INT(11) NOT NULL AUTO_INCREMENT, |
8 |
$dbh->do(q{ |
8 |
`patron_id` INT(11) NOT NULL, |
9 |
CREATE TABLE `api_keys` ( |
9 |
`client_id` VARCHAR(191) NOT NULL, |
10 |
`id` INT(11) NOT NULL AUTO_INCREMENT, |
10 |
`secret` VARCHAR(191) NOT NULL, |
11 |
`patron_id` INT(11) NOT NULL, |
11 |
`description` VARCHAR(255) NOT NULL, |
12 |
`client_id` VARCHAR(191) NOT NULL, |
12 |
`active` TINYINT(1) DEFAULT 1 NOT NULL, |
13 |
`secret` VARCHAR(191) NOT NULL, |
13 |
PRIMARY KEY (`id`), |
14 |
`description` VARCHAR(255) NOT NULL, |
14 |
UNIQUE KEY `client_id` (`client_id`), |
15 |
`active` TINYINT(1) DEFAULT 1 NOT NULL, |
15 |
UNIQUE KEY `secret` (`secret`), |
16 |
PRIMARY KEY (`id`), |
16 |
KEY `patron_id` (`patron_id`), |
17 |
UNIQUE KEY `client_id` (`client_id`), |
17 |
CONSTRAINT `api_keys_fk_patron_id` |
18 |
UNIQUE KEY `secret` (`secret`), |
18 |
FOREIGN KEY (`patron_id`) |
19 |
KEY `patron_id` (`patron_id`), |
19 |
REFERENCES `borrowers` (`borrowernumber`) |
20 |
CONSTRAINT `api_keys_fk_patron_id` |
20 |
ON DELETE CASCADE ON UPDATE CASCADE |
21 |
FOREIGN KEY (`patron_id`) |
21 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
22 |
REFERENCES `borrowers` (`borrowernumber`) |
22 |
}); |
23 |
ON DELETE CASCADE ON UPDATE CASCADE |
23 |
} |
24 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|
|
25 |
}); |
26 |
|
24 |
|
27 |
$dbh->do(q{ |
25 |
$dbh->do(q{ |
28 |
INSERT IGNORE INTO `systempreferences` |
26 |
INSERT IGNORE INTO `systempreferences` |
29 |
- |
|
|