Bugzilla – Attachment 83375 Details for
Bug 22024
Update translated web installer files with new class splitting rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22024: Correct new installations with missing data
Bug-22024-Correct-new-installations-with-missing-d.patch (text/plain), 3.74 KB, created by
Katrin Fischer
on 2018-12-18 22:25:18 UTC
(
hide
)
Description:
Bug 22024: Correct new installations with missing data
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-12-18 22:25:18 UTC
Size:
3.74 KB
patch
obsolete
>From 57154005b665d00171b16962282b0d22b338a486 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Tue, 18 Dec 2018 22:43:05 +0100 >Subject: [PATCH] Bug 22024: Correct new installations with missing data > >For a new installation the data in the class_* will be >missing as class_sources.sql couldn't be executed. It will >fail with: > >DBD::mysql::st execute failed: Cannot add or update a child row: >a foreign key constraint fails (`koha_kohadev`.`class_sources`, >CONSTRAINT `class_source_ibfk_2` FOREIGN KEY (`class_split_rule`) >REFERENCES `class_split_rules` (`class_split_rule`)) at /usr/share/perl5/DBIx/RunSQL.pm line 273. > >As this might have been missed and the web installer can still >be completed, this patch checks for the tables being empty and >adds the default data if they are. > >To test: >- Without the patch >- Run the de-DE or another translated installer >- Verify the error is shown >- Complete the installer >- Verify class_sources table is empty >- Apply patches >- Run the database update >- Verify data classification sources, filing rules, and > slitting rules are now complete >--- > .../atomicupdate/bug_22024-splitting-rules.perl | 40 ++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_22024-splitting-rules.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_22024-splitting-rules.perl b/installer/data/mysql/atomicupdate/bug_22024-splitting-rules.perl >new file mode 100644 >index 0000000000..85e5931aab >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_22024-splitting-rules.perl >@@ -0,0 +1,40 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ >+ # On a new installation the class_sources.sql will have failed, so we need to add all missing data >+ >+ my( $sort_cnt ) = $dbh->selectrow_array( q|SELECT COUNT(*) FROM class_sort_rules|); >+ if( !$sort_cnt ) { >+ $dbh->do(q|INSERT INTO `class_sort_rules` (`class_sort_rule`, `description`, `sort_routine`) VALUES >+ ('dewey', 'Default filing rules for DDC', 'Dewey'), >+ ('lcc', 'Default filing rules for LCC', 'LCC'), >+ ('generic', 'Generic call number filing rules', 'Generic') >+ |); >+ } >+ >+ my ( $split_cnt ) = $dbh->selectrow_array( q|SELECT COUNT(*) FROM class_split_rules|); >+ if( !$split_cnt ) { >+ $dbh->do(q|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') >+ |); >+ } >+ >+ my( $source_cnt ) = $dbh->selectrow_array( q|SELECT COUNT(*) FROM class_sources|); >+ if( !$source_cnt ) { >+ $dbh->do(q|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') >+ |); >+ >+ } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 22024 - Add missing splitting rule definitions)\n"; >+} >-- >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 22024
:
83374
|
83375
|
83396
|
83397
|
83398