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

(-)a/installer/data/mysql/atomicupdate/bug_15836.perl (+42 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    unless( TableExists( 'class_split_rules' ) ) {
4
        $dbh->do(q|
5
            CREATE TABLE class_split_rules (
6
              class_split_rule varchar(10) NOT NULL default '',
7
              description LONGTEXT,
8
              split_routine varchar(30) NOT NULL default '',
9
              split_regex varchar(255) NOT NULL default '',
10
              PRIMARY KEY (class_split_rule),
11
              UNIQUE KEY class_split_rule_idx (class_split_rule)
12
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
13
        |);
14
15
        $dbh->do(q|
16
            ALTER TABLE class_sources
17
            ADD COLUMN class_split_rule varchar(10) NOT NULL default ''
18
            AFTER class_sort_rule
19
        |);
20
        $dbh->do(q|
21
            UPDATE class_sources
22
            SET class_split_rule = class_sort_rule
23
        |);
24
25
        $dbh->do(q|
26
            INSERT INTO class_split_rules(class_split_rule, description, split_routine)
27
            VALUES
28
            ('dewey', 'Default sorting rules for DDC', 'dewey'),
29
            ('lcc', 'Default sorting rules for LCC', 'LCC'),
30
            ('generic', 'Generic call number sorting rules', 'Generic')
31
        |);
32
33
        $dbh->do(q|
34
            ALTER TABLE class_sources
35
            ADD CONSTRAINT class_source_ibfk_2 FOREIGN KEY (class_split_rule)
36
            REFERENCES class_split_rules (class_split_rule)
37
        |);
38
    }
39
40
    SetVersion( $DBversion );
41
    print "Upgrade to $DBversion done (Bug 15836 - Add class_sort_rules.split_routine and split_regex)\n";
42
}
(-)a/installer/data/mysql/en/mandatory/class_sources.sql (-7 / +12 lines)
Lines 3-8 Link Here
3
-- for Koha.
3
-- for Koha.
4
--
4
--
5
-- Copyright (C) 2007 LiblimeA
5
-- Copyright (C) 2007 LiblimeA
6
-- Copyright 2018 Koha Development Team
6
--
7
--
7
-- This file is part of Koha.
8
-- This file is part of Koha.
8
--
9
--
Lines 25-36 INSERT INTO `class_sort_rules` (`class_sort_rule`, `description`, `sort_routine` Link Here
25
                               ('lcc', 'Default filing rules for LCC', 'LCC'),
26
                               ('lcc', 'Default filing rules for LCC', 'LCC'),
26
                               ('generic', 'Generic call number filing rules', 'Generic');
27
                               ('generic', 'Generic call number filing rules', 'Generic');
27
28
29
INSERT INTO `class_split_rules` (`class_split_rule`, `description`, `split_routine`) VALUES
30
                               ('dewey', 'Default splitting rules for DDC', 'Dewey'),
31
                               ('lcc', 'Default splitting rules for LCC', 'LCC'),
32
                               ('generic', 'Generic call number splitting rules', 'Generic');
28
33
29
-- classification schemes or sources
34
-- classification schemes or sources
30
INSERT INTO `class_sources` (`cn_source`, `description`, `used`, `class_sort_rule`) VALUES
35
INSERT INTO `class_sources` (`cn_source`, `description`, `used`, `class_sort_rule`, `class_split_rule`) VALUES
31
                            ('ddc', 'Dewey Decimal Classification', 1, 'dewey'),
36
                            ('ddc', 'Dewey Decimal Classification', 1, 'dewey', 'dewey'),
32
                            ('lcc', 'Library of Congress Classification', 1, 'lcc'),
37
                            ('lcc', 'Library of Congress Classification', 1, 'lcc', 'lcc'),
33
                            ('udc', 'Universal Decimal Classification', 0, 'generic'),
38
                            ('udc', 'Universal Decimal Classification', 0, 'generic', 'generic'),
34
                            ('sudocs', 'SuDoc Classification (U.S. GPO)', 0, 'generic'),
39
                            ('sudocs', 'SuDoc Classification (U.S. GPO)', 0, 'generic', 'generic'),
35
                            ('anscr', 'ANSCR (Sound Recordings)', 0, 'generic'),
40
                            ('anscr', 'ANSCR (Sound Recordings)', 0, 'generic', 'generic'),
36
                            ('z', 'Other/Generic Classification Scheme', 0, 'generic');
41
                            ('z', 'Other/Generic Classification Scheme', 0, 'generic', 'generic');
(-)a/installer/data/mysql/kohastructure.sql (-2 / +20 lines)
Lines 438-447 CREATE TABLE `class_sort_rules` ( Link Here
438
  `class_sort_rule` varchar(10) NOT NULL default '',
438
  `class_sort_rule` varchar(10) NOT NULL default '',
439
  `description` LONGTEXT,
439
  `description` LONGTEXT,
440
  `sort_routine` varchar(30) NOT NULL default '',
440
  `sort_routine` varchar(30) NOT NULL default '',
441
  `split_routine` varchar(30) NOT NULL default '',
442
  `split_regex` varchar(255) NOT NULL default '',
441
  PRIMARY KEY (`class_sort_rule`),
443
  PRIMARY KEY (`class_sort_rule`),
442
  UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
444
  UNIQUE KEY `class_sort_rule_idx` (`class_sort_rule`)
443
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
445
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
444
446
447
--
448
-- Table structure for table `class_split_rules`
449
--
450
451
DROP TABLE IF EXISTS `class_split_rules`;
452
453
CREATE TABLE class_split_rules (
454
  class_split_rule varchar(10) NOT NULL default '',
455
  description LONGTEXT,
456
  split_routine varchar(30) NOT NULL default '',
457
  split_regex varchar(255) NOT NULL default '',
458
  PRIMARY KEY (class_split_rule),
459
  UNIQUE KEY class_split_rule_idx (class_split_rule)
460
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
461
445
--
462
--
446
-- Table structure for table `class_sources`
463
-- Table structure for table `class_sources`
447
--
464
--
Lines 452-461 CREATE TABLE `class_sources` ( Link Here
452
  `description` LONGTEXT,
469
  `description` LONGTEXT,
453
  `used` tinyint(4) NOT NULL default 0,
470
  `used` tinyint(4) NOT NULL default 0,
454
  `class_sort_rule` varchar(10) NOT NULL default '',
471
  `class_sort_rule` varchar(10) NOT NULL default '',
472
  `class_split_rule` varchar(10) NOT NULL default '',
455
  PRIMARY KEY (`cn_source`),
473
  PRIMARY KEY (`cn_source`),
456
  UNIQUE KEY `cn_source_idx` (`cn_source`),
474
  UNIQUE KEY `cn_source_idx` (`cn_source`),
457
  KEY `used_idx` (`used`),
475
  KEY `used_idx` (`used`),
458
  CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`)
476
  CONSTRAINT `class_source_ibfk_1` FOREIGN KEY (`class_sort_rule`) REFERENCES `class_sort_rules` (`class_sort_rule`),
477
  CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) REFERENCES `class_split_rules` (`class_split_rule`)
459
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
478
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
460
479
461
--
480
--
462
- 

Return to bug 15836