Line 0
Link Here
|
|
|
1 |
$DBversion = 'XXX'; # will be replaced by the RM |
2 |
if( CheckVersion( $DBversion ) ) { |
3 |
my $sql = q{ |
4 |
CREATE TABLE IF NOT EXISTS `marc_merge_rules_modules` ( |
5 |
`name` varchar(127) NOT NULL, |
6 |
`description` varchar(255), |
7 |
`specificity` int(11) NOT NULL UNIQUE, |
8 |
PRIMARY KEY(`name`) |
9 |
); |
10 |
}; |
11 |
$dbh->do( $sql ); |
12 |
|
13 |
$dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0);" ); |
14 |
$dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1);" ); |
15 |
$dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2);" ); |
16 |
|
17 |
$sql = q{ |
18 |
CREATE TABLE IF NOT EXISTS `marc_merge_rules` ( |
19 |
`id` int(11) NOT NULL auto_increment, |
20 |
`tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars |
21 |
`module` varchar(127) NOT NULL, |
22 |
`filter` varchar(255) NOT NULL, |
23 |
`add` tinyint NOT NULL, |
24 |
`append` tinyint NOT NULL, |
25 |
`remove` tinyint NOT NULL, |
26 |
`delete` tinyint NOT NULL, |
27 |
PRIMARY KEY(`id`), |
28 |
CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE |
29 |
); |
30 |
}; |
31 |
$dbh->do( $sql ); |
32 |
|
33 |
$sql = q{ |
34 |
INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ( |
35 |
'MARCMergeRules', |
36 |
'0', |
37 |
NULL, |
38 |
'Use the MARC merge rules system to decide what actions to take for each field when modifying records.', |
39 |
'YesNo' |
40 |
); |
41 |
}; |
42 |
$dbh->do( $sql ); |
43 |
|
44 |
$sql = q{ |
45 |
INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( |
46 |
3, |
47 |
'manage_marc_merge_rules', |
48 |
'Manage MARC merge rules configuration' |
49 |
); |
50 |
}; |
51 |
$dbh->do( $sql ); |
52 |
|
53 |
# Always end with this (adjust the bug info) |
54 |
SetVersion( $DBversion ); |
55 |
print "Upgrade to $DBversion done (Bug 14957 - Write protecting MARC fields based on source of import)\n"; |
56 |
} |