View | Details | Raw Unified | Return to bug 13068
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/oai_sets.sql (-35 lines)
Lines 1-35 Link Here
1
DROP TABLE IF EXISTS `oai_sets_descriptions`;
2
DROP TABLE IF EXISTS `oai_sets_mappings`;
3
DROP TABLE IF EXISTS `oai_sets_biblios`;
4
DROP TABLE IF EXISTS `oai_sets`;
5
6
CREATE TABLE `oai_sets` (
7
  `id` int(11) NOT NULL auto_increment,
8
  `spec` varchar(80) NOT NULL UNIQUE,
9
  `name` varchar(80) NOT NULL,
10
  PRIMARY KEY (`id`)
11
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
12
13
CREATE TABLE `oai_sets_descriptions` (
14
  `set_id` int(11) NOT NULL,
15
  `description` varchar(255) NOT NULL,
16
  CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
17
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
19
CREATE TABLE `oai_sets_mappings` (
20
  `set_id` int(11) NOT NULL,
21
  `marcfield` char(3) NOT NULL,
22
  `marcsubfield` char(1) NOT NULL,
23
  `marcvalue` varchar(80) NOT NULL,
24
  CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
25
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
26
27
CREATE TABLE `oai_sets_biblios` (
28
  `biblionumber` int(11) NOT NULL,
29
  `set_id` int(11) NOT NULL,
30
  PRIMARY KEY (`biblionumber`, `set_id`),
31
  CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
32
  CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
33
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
34
35
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');
(-)a/installer/data/mysql/updatedatabase.pl (-8 / +41 lines)
Lines 4942-4951 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
    my $installer = C4::Installer->new();
4945
    $dbh->do(qq{
4946
    my $full_path = C4::Context->config('intranetdir') . "/installer/data/$installer->{dbms}/atomicupdate/oai_sets.sql";
4946
DROP TABLE IF EXISTS `oai_sets_descriptions`;
4947
    my $error     = $installer->load_sql($full_path);
4947
DROP TABLE IF EXISTS `oai_sets_mappings`;
4948
    warn $error if $error;
4948
DROP TABLE IF EXISTS `oai_sets_biblios`;
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
4958
CREATE TABLE `oai_sets_descriptions` (
4959
  `set_id` int(11) NOT NULL,
4960
  `description` varchar(255) NOT NULL,
4961
  CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4962
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4963
4964
CREATE TABLE `oai_sets_mappings` (
4965
  `set_id` int(11) NOT NULL,
4966
  `marcfield` char(3) NOT NULL,
4967
  `marcsubfield` char(1) NOT NULL,
4968
  `marcvalue` varchar(80) NOT NULL,
4969
  CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4970
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4971
4972
CREATE TABLE `oai_sets_biblios` (
4973
  `biblionumber` int(11) NOT NULL,
4974
  `set_id` int(11) NOT NULL,
4975
  PRIMARY KEY (`biblionumber`, `set_id`),
4976
  CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4977
  CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4978
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4979
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');
4981
4982
});
4949
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
4983
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
4950
    SetVersion($DBversion);
4984
    SetVersion($DBversion);
4951
}
4985
}
Lines 9814-9822 my $old_delimiter = $/; Link Here
9814
$/ = ';';
9848
$/ = ';';
9815
while (readdir $dirh) {
9849
while (readdir $dirh) {
9816
    next unless $_ =~ /\.sql$/; # skip non SQL files
9850
    next unless $_ =~ /\.sql$/; # skip non SQL files
9817
        my $installer = C4::Installer->new();
9851
    print "DEV atomic update : $_ \n";
9818
        $rv = $installer->load_sql( $atomicupd->{location}. "/$file" )? 0: 1;
9852
    my $installer = C4::Installer->new();
9819
        #Note: load_sql already warns
9853
    my $rv = $installer->load_sql( C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/' . $_ )? 0: 1;
9820
}
9854
}
9821
9855
9822
9856
9823
- 

Return to bug 13068