Bugzilla – Attachment 81627 Details for
Bug 15836
Labels: Offer configuration option for splitting call numbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15836: DB changes
Bug-15836-DB-changes.patch (text/plain), 6.88 KB, created by
Jonathan Druart
on 2018-10-30 15:55:31 UTC
(
hide
)
Description:
Bug 15836: DB changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-10-30 15:55:31 UTC
Size:
6.88 KB
patch
obsolete
>From d8a81d7bb07c34045797243cc29dcf2a5e880d7c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Jun 2018 12:57:09 -0300 >Subject: [PATCH] Bug 15836: DB changes >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Sponsored-by: Goethe-Institut > >Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > installer/data/mysql/atomicupdate/bug_15836.perl | 42 ++++++++++++++++++++++ > .../data/mysql/en/mandatory/class_sources.sql | 19 ++++++---- > installer/data/mysql/kohastructure.sql | 21 ++++++++++- > 3 files changed, 74 insertions(+), 8 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_15836.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_15836.perl b/installer/data/mysql/atomicupdate/bug_15836.perl >new file mode 100644 >index 0000000000..069b7503f8 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_15836.perl >@@ -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"; >+} >diff --git a/installer/data/mysql/en/mandatory/class_sources.sql b/installer/data/mysql/en/mandatory/class_sources.sql >index 589ea7a689..735ef28583 100644 >--- a/installer/data/mysql/en/mandatory/class_sources.sql >+++ b/installer/data/mysql/en/mandatory/class_sources.sql >@@ -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'); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 62c0dcecfb..f159cfe1a6 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -438,11 +438,28 @@ 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; > > -- >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15836
:
76691
|
76692
|
76693
|
76694
|
76695
|
76696
|
77061
|
77079
|
77306
|
78791
|
78793
|
78795
|
78796
|
78798
|
78799
|
79029
|
80339
|
80340
|
80341
|
80342
|
80343
|
80344
|
80345
|
80346
|
80347
|
80548
|
80549
|
80550
|
80551
|
80552
|
80553
|
80554
|
80555
|
80556
|
81033
|
81034
|
81035
|
81036
|
81037
|
81038
|
81039
|
81040
|
81041
|
81627
|
81628
|
81629
|
81630
|
81631
|
81632
|
81633
|
81634
|
81635
|
82110
|
82112
|
82113
|
82118
|
82119
|
82120
|
82289
|
82290
|
82291
|
82292
|
82293
|
82294
|
82295
|
82296
|
82297
|
82298
|
82299
|
82300
|
82301
|
82302
|
82317
|
82318
|
82319
|
82321