Line 0
Link Here
|
0 |
- |
1 |
DROP TABLE IF EXISTS `marc_permissions`; |
|
|
2 |
DROP TABLE IF EXISTS `marc_permissions_modules`; |
3 |
|
4 |
CREATE TABLE `marc_permissions_modules` ( |
5 |
`id` int(11) NOT NULL auto_increment, |
6 |
`name` varchar(24) NOT NULL, |
7 |
`description` varchar(255), |
8 |
`specificity` int(11) NOT NULL DEFAULT 0, -- higher specificity will override rules with lower specificity |
9 |
PRIMARY KEY(`id`) |
10 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
11 |
|
12 |
-- a couple of useful default filter modules |
13 |
-- these are used in various scripts, so don't remove them if you don't know |
14 |
-- what you're doing. |
15 |
-- New filter modules can be added here when needed |
16 |
INSERT INTO `marc_permissions_modules` VALUES(NULL, 'source', 'source from where modification request was sent', 0); |
17 |
INSERT INTO `marc_permissions_modules` VALUES(NULL, 'category', 'categorycode of user who requested modification', 1); |
18 |
INSERT INTO `marc_permissions_modules` VALUES(NULL, 'borrower', 'borrowernumber of user who requested modification', 2); |
19 |
|
20 |
CREATE TABLE `marc_permissions` ( |
21 |
`id` int(11) NOT NULL auto_increment, |
22 |
`tagfield` varchar(255) NOT NULL, -- can be regexe, so need > 3 chars |
23 |
`tagsubfield` varchar(255) DEFAULT NULL, -- can be regex, so need > 1 char |
24 |
`module` int(11) NOT NULL, |
25 |
`filter` varchar(255) NOT NULL, |
26 |
`on_existing` ENUM('skip', 'overwrite', 'add', 'add_or_correct') DEFAULT NULL, |
27 |
`on_new` ENUM('skip', 'add') DEFAULT NULL, |
28 |
`on_removed` ENUM('skip', 'remove') DEFAULT NULL, |
29 |
PRIMARY KEY(`id`), |
30 |
CONSTRAINT `marc_permissions_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_permissions_modules` (`id`) ON DELETE CASCADE |
31 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |