Bugzilla – Attachment 87929 Details for
Bug 14957
Write protecting MARC fields based on source of import
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14957: Put database updates in perl script
Bug-14957-Put-database-updates-in-perl-script.patch (text/plain), 6.08 KB, created by
David Gustafsson
on 2019-04-12 17:49:01 UTC
(
hide
)
Description:
Bug 14957: Put database updates in perl script
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2019-04-12 17:49:01 UTC
Size:
6.08 KB
patch
obsolete
>From 985eaba25c80d118744bfad01b4b37078f52b214 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 12 Apr 2019 19:46:38 +0200 >Subject: [PATCH] Bug 14957: Put database updates in perl script > >Also add schema changes to kohastructure.sql and syspref to sysprefs.sql >--- > .../bug_14957-marc-merge-rules-permissions.sql | 2 - > .../atomicupdate/bug_14957-marc-merge-rules.perl | 56 ++++++++++++++++++++++ > .../atomicupdate/bug_14957-marc-merge-rules.sql | 30 ------------ > .../atomicupdate/bug_14957-merge-rules-syspref.sql | 1 - > 4 files changed, 56 insertions(+), 33 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql >deleted file mode 100644 >index 87739b558b..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql >+++ /dev/null >@@ -1,2 +0,0 @@ >-INSERT INTO permissions (module_bit, code, description) VALUES >- ( 3, 'manage_marc_merge_rules', 'Manage MARC merge rules configuration'); >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl >new file mode 100644 >index 0000000000..535f619c20 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl >@@ -0,0 +1,56 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ my $sql = q{ >+ CREATE TABLE IF NOT EXISTS `marc_merge_rules_modules` ( >+ `name` varchar(127) NOT NULL, >+ `description` varchar(255), >+ `specificity` int(11) NOT NULL UNIQUE, >+ PRIMARY KEY(`name`) >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0);" ); >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1);" ); >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2);" ); >+ >+ $sql = q{ >+ CREATE TABLE IF NOT EXISTS `marc_merge_rules` ( >+ `id` int(11) NOT NULL auto_increment, >+ `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars >+ `module` varchar(127) NOT NULL, >+ `filter` varchar(255) NOT NULL, >+ `add` tinyint NOT NULL, >+ `append` tinyint NOT NULL, >+ `remove` tinyint NOT NULL, >+ `delete` tinyint NOT NULL, >+ PRIMARY KEY(`id`), >+ CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $sql = q{ >+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ( >+ 'MARCMergeRules', >+ '0', >+ NULL, >+ 'Use the MARC merge rules system to decide what actions to take for each field when modifying records.', >+ 'YesNo' >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $sql = q{ >+ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( >+ 3, >+ 'manage_marc_merge_rules', >+ 'Manage MARC merge rules configuration' >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 14957 - Write protecting MARC fields based on source of import)\n"; >+} >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql >deleted file mode 100644 >index 67554d7599..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql >+++ /dev/null >@@ -1,30 +0,0 @@ >-DROP TABLE IF EXISTS `marc_merge_rules`; >-DROP TABLE IF EXISTS `marc_merge_rules_modules`; >- >-CREATE TABLE `marc_merge_rules_modules` ( >- `name` varchar(127) NOT NULL, >- `description` varchar(255), >- `specificity` int(11) NOT NULL UNIQUE, -- higher specificity will override rules with lower specificity >- PRIMARY KEY(`name`) >-); >- >--- a couple of useful default filter modules >--- these are used in various scripts, so don't remove them if you don't know >--- what you're doing. >--- New filter modules can be added here when needed >-INSERT INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0); >-INSERT INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1); >-INSERT INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2); >- >-CREATE TABLE IF NOT EXISTS `marc_merge_rules` ( >- `id` int(11) NOT NULL auto_increment, >- `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars >- `module` varchar(127) NOT NULL, >- `filter` varchar(255) NOT NULL, >- `add` tinyint NOT NULL, >- `append` tinyint NOT NULL, >- `remove` tinyint NOT NULL, >- `delete` tinyint NOT NULL, >- PRIMARY KEY(`id`), >- CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE >-); >diff --git a/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql b/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql >deleted file mode 100644 >index 5116c0a355..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql >+++ /dev/null >@@ -1 +0,0 @@ >-INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('MARCMergeRules','0','','Use the MARC merge rules system to decide what actions to take for each field when modifying records.','YesNo'); >-- >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 14957
:
44056
|
44057
|
44058
|
51723
|
51724
|
56637
|
56638
|
56643
|
56644
|
56645
|
56646
|
56647
|
56648
|
57114
|
57115
|
57116
|
57117
|
57118
|
57119
|
59811
|
59812
|
59885
|
60711
|
60824
|
60825
|
61065
|
61641
|
61736
|
64792
|
72498
|
74855
|
75118
|
76201
|
76202
|
76203
|
76204
|
76205
|
76206
|
76207
|
76208
|
76209
|
76210
|
78651
|
78652
|
78653
|
79367
|
79368
|
79369
|
79370
|
79890
|
80972
|
80973
|
80974
|
80975
|
81176
|
81177
|
81178
|
81179
|
81621
|
81699
|
81700
|
81705
|
81706
|
81707
|
81708
|
81969
|
81970
|
81971
|
82030
|
82031
|
82775
|
87709
|
87711
|
87771
|
87929
|
88205
|
88206
|
89961
|
90668
|
90669
|
90671
|
90672
|
90722
|
90723
|
90740
|
90741
|
92933
|
92934
|
92935
|
92936
|
92937
|
92938
|
92999
|
93499
|
94909
|
94911
|
99998
|
100052
|
100053
|
100054
|
100055
|
100056
|
100057
|
100058
|
100059
|
100060
|
100061
|
101510
|
109955
|
109956
|
109957
|
109958
|
109959
|
109960
|
109961
|
109962
|
109963
|
116622
|
116623
|
116624
|
116625
|
117844
|
117845
|
117849
|
117850
|
117853
|
117859
|
117964
|
117965
|
117966
|
118918
|
118919
|
118920
|
118921
|
118922
|
118923
|
118924
|
118925
|
118926
|
118927
|
118934
|
118935
|
118936
|
118937
|
118938
|
118939
|
118940
|
118941
|
118942
|
118943
|
118944
|
118945
|
118946
|
118957
|
120533
|
120534
|
120535
|
120536
|
120537
|
120538
|
120539
|
120540
|
120541
|
120542
|
120543
|
120544
|
120545
|
120546
|
120547
|
120548
|
120550
|
120553
|
120554
|
120555
|
120556
|
120557
|
120581
|
120582
|
120583
|
120584
|
120585
|
120586
|
120587
|
120588
|
120589
|
120590
|
120591
|
120592
|
120593
|
120594
|
120595
|
120596
|
120597
|
120598
|
120599
|
120600
|
120601
|
120602
|
120603
|
120604
|
120605
|
120670
|
120671
|
120705
|
125514
|
125515
|
125516
|
125517
|
125518
|
125519
|
125520
|
125521
|
125522
|
125523
|
125524
|
125525
|
125526
|
125527
|
125528
|
125529
|
125530
|
125531
|
125532
|
125533
|
125534
|
125535
|
125536
|
125537
|
125538
|
125539
|
125540
|
125632
|
125633
|
125636
|
126424
|
126425
|
126431
|
126592
|
126666
|
126667
|
126752
|
126753
|
126754
|
126755
|
126756
|
126757
|
126758
|
126759
|
126760
|
126761
|
126762
|
126763
|
126764
|
126765
|
126766
|
126767
|
126768
|
126769
|
126770
|
126771
|
126772
|
126773
|
126774
|
126775
|
126776
|
126777
|
126778
|
126779
|
126780
|
126781
|
126782
|
126783
|
126784
|
126785
|
126786
|
126950
|
126951