From b5fa49195557e23d027ed9f2db899e0b3970b760 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 13 Apr 2017 09:09:05 -0400 Subject: [PATCH] Bug 9988 - DBRev 16.12.00.023 Signed-off-by: Kyle M Hall --- Koha.pm | 2 +- Koha/Schema/Result/NeedMergeAuthority.pm | 20 ++++++------ .../data/mysql/atomicupdate/bug_9988a.perl | 19 ----------- .../mysql/atomicupdate/bug_9988b_table.perl | 14 -------- .../mysql/atomicupdate/bug_9988c_cron.perl | 6 ---- installer/data/mysql/updatedatabase.pl | 32 +++++++++++++++++++ 6 files changed, 43 insertions(+), 50 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_9988a.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_9988b_table.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_9988c_cron.perl diff --git a/Koha.pm b/Koha.pm index 6ff200e553..4b56b96264 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "16.12.00.022"; +$VERSION = "16.12.00.023"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/NeedMergeAuthority.pm b/Koha/Schema/Result/NeedMergeAuthority.pm index dd7f3185a4..614be246c1 100644 --- a/Koha/Schema/Result/NeedMergeAuthority.pm +++ b/Koha/Schema/Result/NeedMergeAuthority.pm @@ -44,12 +44,6 @@ __PACKAGE__->table("need_merge_authorities"); data_type: 'text' is_nullable: 1 -=head2 done - - data_type: 'tinyint' - default_value: 0 - is_nullable: 1 - =head2 timestamp data_type: 'timestamp' @@ -57,6 +51,12 @@ __PACKAGE__->table("need_merge_authorities"); default_value: current_timestamp is_nullable: 0 +=head2 done + + data_type: 'tinyint' + default_value: 0 + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -68,8 +68,6 @@ __PACKAGE__->add_columns( { data_type => "bigint", is_nullable => 1 }, "reportxml", { data_type => "text", is_nullable => 1 }, - "done", - { data_type => "tinyint", default_value => 0, is_nullable => 1 }, "timestamp", { data_type => "timestamp", @@ -77,6 +75,8 @@ __PACKAGE__->add_columns( default_value => \"current_timestamp", is_nullable => 0, }, + "done", + { data_type => "tinyint", default_value => 0, is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -92,8 +92,8 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-02-18 16:34:45 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QCbtlKCgozivph6ozRzznQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-04-12 19:42:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BW1u1si2H88+GS/Ok8fuGA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_9988a.perl b/installer/data/mysql/atomicupdate/bug_9988a.perl deleted file mode 100644 index 9edd22b9a2..0000000000 --- a/installer/data/mysql/atomicupdate/bug_9988a.perl +++ /dev/null @@ -1,19 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - my $oldval = C4::Context->preference('dontmerge'); - my $newval = $oldval ? 0 : 50; - - # Remove dontmerge, add AuthorityMergeLimit - $dbh->do(q/ -DELETE FROM systempreferences WHERE variable = 'dontmerge'; - /); - $dbh->do(qq/ -INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('AuthorityMergeLimit','$newval',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'); - /); - - SetVersion( $DBversion ); - if( $newval == 0 ) { - print "NOTE: Since dontmerge was enabled, we have initialized AuthorityMergeLimit to 0 records. Please consider raising this value. This will allow for performing smaller merges directly and only postponing larger merges.\n"; - } - print "Upgrade to $DBversion done (Bug 9988 - Add AuthorityMergeLimit)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_9988b_table.perl b/installer/data/mysql/atomicupdate/bug_9988b_table.perl deleted file mode 100644 index d3de62074b..0000000000 --- a/installer/data/mysql/atomicupdate/bug_9988b_table.perl +++ /dev/null @@ -1,14 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( -q|ALTER TABLE need_merge_authorities -ADD COLUMN authid_new BIGINT AFTER authid, -ADD COLUMN reportxml text AFTER authid_new, -ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;| - ); - - $dbh->do( q|UPDATE need_merge_authorities SET authid_new=authid WHERE done<>1| ); - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 9988 - Alter table need_merge_authorities)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_9988c_cron.perl b/installer/data/mysql/atomicupdate/bug_9988c_cron.perl deleted file mode 100644 index bedef31722..0000000000 --- a/installer/data/mysql/atomicupdate/bug_9988c_cron.perl +++ /dev/null @@ -1,6 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - print "IMPORTANT NOTE: If you are not using a regular Debian install, please verify that you no longer use misc/migration_tools/merge_authority.pl in your cron files AND add misc/cronjobs/merge_authorities.pl to cron now. This job is no longer optional! You need it to perform larger authority merges.\n"; - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 9988 - Cron alert)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2ad9c9f474..19b360d48e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -14076,6 +14076,38 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 17866 - Change sender for serial claim notifications)\n"; } +$DBversion = '16.12.00.023'; +if( CheckVersion( $DBversion ) ) { + my $oldval = C4::Context->preference('dontmerge'); + my $newval = $oldval ? 0 : 50; + + # Remove dontmerge, add AuthorityMergeLimit + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable = 'dontmerge'; + }); + $dbh->do(qq{ + INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('AuthorityMergeLimit','$newval',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'); + }); + + $dbh->do(q{ + ALTER TABLE need_merge_authorities + ADD COLUMN authid_new BIGINT AFTER authid, + ADD COLUMN reportxml text AFTER authid_new, + ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; + }); + + $dbh->do(q{ + UPDATE need_merge_authorities SET authid_new=authid WHERE done <> 1 + }); + + SetVersion( $DBversion ); + if( $newval == 0 ) { + print "NOTE: Since dontmerge was enabled, we have initialized AuthorityMergeLimit to 0 records. Please consider raising this value. This will allow for performing smaller merges directly and only postponing larger merges.\n"; + } + print "IMPORTANT NOTE: If you are not using a Debian package install, please verify that you no longer use misc/migration_tools/merge_authority.pl in your cron files AND add misc/cronjobs/merge_authorities.pl to cron now. This job is no longer optional! You need it to perform larger authority merges.\n"; + print "Upgrade to $DBversion done (Bug 9988 - Add AuthorityMergeLimit)\n"; +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5