Lines 4942-4985
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
4942 |
|
4942 |
|
4943 |
$DBversion = "3.07.00.029"; |
4943 |
$DBversion = "3.07.00.029"; |
4944 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
4944 |
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { |
4945 |
$dbh->do(qq{ |
4945 |
$dbh->do(q{DROP TABLE IF EXISTS `oai_sets_descriptions`;}); |
4946 |
DROP TABLE IF EXISTS `oai_sets_descriptions`; |
4946 |
$dbh->do(q{DROP TABLE IF EXISTS `oai_sets_mappings`;}); |
4947 |
DROP TABLE IF EXISTS `oai_sets_mappings`; |
4947 |
$dbh->do(q{DROP TABLE IF EXISTS `oai_sets_biblios`;}); |
4948 |
DROP TABLE IF EXISTS `oai_sets_biblios`; |
4948 |
$dbh->do(q{DROP TABLE IF EXISTS `oai_sets`;}); |
4949 |
DROP TABLE IF EXISTS `oai_sets`; |
|
|
4950 |
|
4951 |
CREATE TABLE `oai_sets` ( |
4952 |
`id` int(11) NOT NULL auto_increment, |
4953 |
`spec` varchar(80) NOT NULL UNIQUE, |
4954 |
`name` varchar(80) NOT NULL, |
4955 |
PRIMARY KEY (`id`) |
4956 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4957 |
|
4949 |
|
4958 |
CREATE TABLE `oai_sets_descriptions` ( |
4950 |
$dbh->do(q{ |
4959 |
`set_id` int(11) NOT NULL, |
4951 |
CREATE TABLE `oai_sets` ( |
4960 |
`description` varchar(255) NOT NULL, |
4952 |
`id` int(11) NOT NULL auto_increment, |
4961 |
CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
4953 |
`spec` varchar(80) NOT NULL UNIQUE, |
4962 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4954 |
`name` varchar(80) NOT NULL, |
|
|
4955 |
PRIMARY KEY (`id`) |
4956 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4957 |
}); |
4963 |
|
4958 |
|
4964 |
CREATE TABLE `oai_sets_mappings` ( |
4959 |
$dbh->do(q{ |
4965 |
`set_id` int(11) NOT NULL, |
4960 |
CREATE TABLE `oai_sets_descriptions` ( |
4966 |
`marcfield` char(3) NOT NULL, |
4961 |
`set_id` int(11) NOT NULL, |
4967 |
`marcsubfield` char(1) NOT NULL, |
4962 |
`description` varchar(255) NOT NULL, |
4968 |
`marcvalue` varchar(80) NOT NULL, |
4963 |
CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
4969 |
CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
4964 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4970 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4965 |
}); |
4971 |
|
4966 |
|
4972 |
CREATE TABLE `oai_sets_biblios` ( |
4967 |
$dbh->do(q{ |
4973 |
`biblionumber` int(11) NOT NULL, |
4968 |
CREATE TABLE `oai_sets_mappings` ( |
4974 |
`set_id` int(11) NOT NULL, |
4969 |
`set_id` int(11) NOT NULL, |
4975 |
PRIMARY KEY (`biblionumber`, `set_id`), |
4970 |
`marcfield` char(3) NOT NULL, |
4976 |
CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, |
4971 |
`marcsubfield` char(1) NOT NULL, |
4977 |
CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
4972 |
`marcvalue` varchar(80) NOT NULL, |
4978 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4973 |
CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
|
|
4974 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4975 |
}); |
4979 |
|
4976 |
|
4980 |
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo'); |
4977 |
$dbh->do(q{ |
|
|
4978 |
CREATE TABLE `oai_sets_biblios` ( |
4979 |
`biblionumber` int(11) NOT NULL, |
4980 |
`set_id` int(11) NOT NULL, |
4981 |
PRIMARY KEY (`biblionumber`, `set_id`), |
4982 |
CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, |
4983 |
CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
4984 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
4985 |
}); |
4986 |
|
4987 |
$dbh->do(q{ |
4988 |
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo'); |
4989 |
}); |
4981 |
|
4990 |
|
4982 |
}); |
|
|
4983 |
print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n"; |
4991 |
print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n"; |
4984 |
SetVersion($DBversion); |
4992 |
SetVersion($DBversion); |
4985 |
} |
4993 |
} |
4986 |
- |
|
|