Bug 15836: DB changes
Sponsored-by: Goethe-Institut Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
3a0cba67f1
commit
df22811f7b
3 changed files with 74 additions and 8 deletions
42
installer/data/mysql/atomicupdate/bug_15836.perl
Normal file
42
installer/data/mysql/atomicupdate/bug_15836.perl
Normal file
|
@ -0,0 +1,42 @@
|
|||
$DBversion = 'XXX';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
unless( TableExists( 'class_split_rules' ) ) {
|
||||
$dbh->do(q|
|
||||
CREATE TABLE class_split_rules (
|
||||
class_split_rule varchar(10) NOT NULL default '',
|
||||
description LONGTEXT,
|
||||
split_routine varchar(30) NOT NULL default '',
|
||||
split_regex varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (class_split_rule),
|
||||
UNIQUE KEY class_split_rule_idx (class_split_rule)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
|);
|
||||
|
||||
$dbh->do(q|
|
||||
ALTER TABLE class_sources
|
||||
ADD COLUMN class_split_rule varchar(10) NOT NULL default ''
|
||||
AFTER class_sort_rule
|
||||
|);
|
||||
$dbh->do(q|
|
||||
UPDATE class_sources
|
||||
SET class_split_rule = class_sort_rule
|
||||
|);
|
||||
|
||||
$dbh->do(q|
|
||||
INSERT INTO class_split_rules(class_split_rule, description, split_routine)
|
||||
VALUES
|
||||
('dewey', 'Default sorting rules for DDC', 'dewey'),
|
||||
('lcc', 'Default sorting rules for LCC', 'LCC'),
|
||||
('generic', 'Generic call number sorting rules', 'Generic')
|
||||
|);
|
||||
|
||||
$dbh->do(q|
|
||||
ALTER TABLE class_sources
|
||||
ADD CONSTRAINT class_source_ibfk_2 FOREIGN KEY (class_split_rule)
|
||||
REFERENCES class_split_rules (class_split_rule)
|
||||
|);
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 15836 - Add class_sort_rules.split_routine and split_regex)\n";
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
-- for Koha.
|
||||
--
|
||||
-- Copyright (C) 2007 LiblimeA
|
||||
-- Copyright 2018 Koha Development Team
|
||||
--
|
||||
-- This file is part of Koha.
|
||||
--
|
||||
|
@ -25,12 +26,16 @@ INSERT INTO `class_sort_rules` (`class_sort_rule`, `description`, `sort_routine`
|
|||
('lcc', 'Default filing rules for LCC', 'LCC'),
|
||||
('generic', 'Generic call number filing rules', 'Generic');
|
||||
|
||||
INSERT INTO `class_split_rules` (`class_split_rule`, `description`, `split_routine`) VALUES
|
||||
('dewey', 'Default splitting rules for DDC', 'Dewey'),
|
||||
('lcc', 'Default splitting rules for LCC', 'LCC'),
|
||||
('generic', 'Generic call number splitting rules', 'Generic');
|
||||
|
||||
-- classification schemes or sources
|
||||
INSERT INTO `class_sources` (`cn_source`, `description`, `used`, `class_sort_rule`) VALUES
|
||||
('ddc', 'Dewey Decimal Classification', 1, 'dewey'),
|
||||
('lcc', 'Library of Congress Classification', 1, 'lcc'),
|
||||
('udc', 'Universal Decimal Classification', 0, 'generic'),
|
||||
('sudocs', 'SuDoc Classification (U.S. GPO)', 0, 'generic'),
|
||||
('anscr', 'ANSCR (Sound Recordings)', 0, 'generic'),
|
||||
('z', 'Other/Generic Classification Scheme', 0, 'generic');
|
||||
INSERT INTO `class_sources` (`cn_source`, `description`, `used`, `class_sort_rule`, `class_split_rule`) VALUES
|
||||
('ddc', 'Dewey Decimal Classification', 1, 'dewey', 'dewey'),
|
||||
('lcc', 'Library of Congress Classification', 1, 'lcc', 'lcc'),
|
||||
('udc', 'Universal Decimal Classification', 0, 'generic', 'generic'),
|
||||
('sudocs', 'SuDoc Classification (U.S. GPO)', 0, 'generic', 'generic'),
|
||||
('anscr', 'ANSCR (Sound Recordings)', 0, 'generic', 'generic'),
|
||||
('z', 'Other/Generic Classification Scheme', 0, 'generic', 'generic');
|
||||
|
|
|
@ -438,10 +438,27 @@ CREATE TABLE `class_sort_rules` (
|
|||
`class_sort_rule` varchar(10) NOT NULL default '',
|
||||
`description` LONGTEXT,
|
||||
`sort_routine` varchar(30) NOT NULL default '',
|
||||
`split_routine` varchar(30) NOT NULL default '',
|
||||
`split_regex` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`class_sort_rule`),
|
||||
UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `class_split_rules`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `class_split_rules`;
|
||||
|
||||
CREATE TABLE class_split_rules (
|
||||
class_split_rule varchar(10) NOT NULL default '',
|
||||
description LONGTEXT,
|
||||
split_routine varchar(30) NOT NULL default '',
|
||||
split_regex varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (class_split_rule),
|
||||
UNIQUE KEY class_split_rule_idx (class_split_rule)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `class_sources`
|
||||
--
|
||||
|
@ -452,10 +469,12 @@ CREATE TABLE `class_sources` (
|
|||
`description` LONGTEXT,
|
||||
`used` tinyint(4) NOT NULL default 0,
|
||||
`class_sort_rule` varchar(10) NOT NULL default '',
|
||||
`class_split_rule` varchar(10) NOT NULL default '',
|
||||
PRIMARY KEY (`cn_source`),
|
||||
UNIQUE KEY `cn_source_idx` (`cn_source`),
|
||||
KEY `used_idx` (`used`),
|
||||
CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
|
||||
CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
|
||||
CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in a new issue