From 6f9341a7f79fd913669ee870a7f243f74d52498f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 17 Apr 2019 11:15:22 +0000 Subject: [PATCH] Bug 21336: DBRev 18.12.00.051 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/Borrower.pm | 18 ++++++++++-- Koha/Schema/Result/Deletedborrower.pm | 18 ++++++++++-- .../data/mysql/atomicupdate/bug_21336a.perl | 7 ----- .../data/mysql/atomicupdate/bug_21336b.perl | 12 -------- .../data/mysql/atomicupdate/bug_21336c.perl | 6 ---- installer/data/mysql/updatedatabase.pl | 28 +++++++++++++++++++ 7 files changed, 61 insertions(+), 30 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_21336a.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_21336b.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_21336c.perl diff --git a/Koha.pm b/Koha.pm index 9f6047451b..b7ded1dc60 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 = "18.12.00.048"; +$VERSION = "18.12.00.051"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 0c439e90b6..f2fa3bff38 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -451,6 +451,13 @@ __PACKAGE__->table("borrowers"); data_type: 'mediumtext' is_nullable: 1 +=head2 flgAnonymized + + accessor: 'flg_anonymized' + data_type: 'tinyint' + default_value: 0 + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -653,6 +660,13 @@ __PACKAGE__->add_columns( { data_type => "integer", default_value => 0, is_nullable => 1 }, "overdrive_auth_token", { data_type => "mediumtext", is_nullable => 1 }, + "flgAnonymized", + { + accessor => "flg_anonymized", + data_type => "tinyint", + default_value => 0, + is_nullable => 1, + }, ); =head1 PRIMARY KEY @@ -1521,8 +1535,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-03-22 20:06:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dbRPH4TDrnUkzbJdgM5XcQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-17 11:11:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZkPU/EUsZVXiRoQ1E8NMbw __PACKAGE__->belongs_to( "guarantor", diff --git a/Koha/Schema/Result/Deletedborrower.pm b/Koha/Schema/Result/Deletedborrower.pm index 4d15e35c1f..dc20a65d4e 100644 --- a/Koha/Schema/Result/Deletedborrower.pm +++ b/Koha/Schema/Result/Deletedborrower.pm @@ -448,6 +448,13 @@ __PACKAGE__->table("deletedborrowers"); data_type: 'mediumtext' is_nullable: 1 +=head2 flgAnonymized + + accessor: 'flg_anonymized' + data_type: 'tinyint' + default_value: 0 + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -638,11 +645,18 @@ __PACKAGE__->add_columns( { data_type => "integer", default_value => 0, is_nullable => 1 }, "overdrive_auth_token", { data_type => "mediumtext", is_nullable => 1 }, + "flgAnonymized", + { + accessor => "flg_anonymized", + data_type => "tinyint", + default_value => 0, + is_nullable => 1, + }, ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DNkNHNcv0lkMH6/seu89hg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-17 11:11:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9XbNY+E7YqzsiUldTFg6Zg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/installer/data/mysql/atomicupdate/bug_21336a.perl b/installer/data/mysql/atomicupdate/bug_21336a.perl deleted file mode 100644 index ad45908965..0000000000 --- a/installer/data/mysql/atomicupdate/bug_21336a.perl +++ /dev/null @@ -1,7 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( "ALTER TABLE borrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('borrowers', 'flgAnonymized'); - $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('deletedborrowers', 'flgAnonymized'); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 21336 - Add field flgAnonymized)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_21336b.perl b/installer/data/mysql/atomicupdate/bug_21336b.perl deleted file mode 100644 index 926f54e074..0000000000 --- a/installer/data/mysql/atomicupdate/bug_21336b.perl +++ /dev/null @@ -1,12 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| -INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) -VALUES -('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'), -('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'), -('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer') - |); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 21336 - Add preferences)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_21336c.perl b/installer/data/mysql/atomicupdate/bug_21336c.perl deleted file mode 100644 index 338f8f8fc5..0000000000 --- a/installer/data/mysql/atomicupdate/bug_21336c.perl +++ /dev/null @@ -1,6 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( "UPDATE borrowers SET login_attempts = ? WHERE login_attempts > ?", undef, C4::Context->preference('FailedLoginAttempts'), C4::Context->preference('FailedLoginAttempts') ); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 21336 - Reset login_attempts)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 402114e4d2..46b6a7fe38 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -18035,6 +18035,34 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 22044 - Set a default value for NoRenewalBeforePrecision)\n"; } +$DBversion = '18.12.00.049'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( "ALTER TABLE borrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('borrowers', 'flgAnonymized'); + $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN flgAnonymized tinyint DEFAULT 0" ) if !column_exists('deletedborrowers', 'flgAnonymized'); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 21336 - Add field flgAnonymized)\n"; +} + +$DBversion = '18.12.00.050'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( q| +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) +VALUES +('UnsubscribeReflectionDelay','',NULL,'Delay for locking unsubscribers', 'Integer'), +('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'), +('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer') + |); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 21336 - Add preferences)\n"; +} + +$DBversion = '18.12.00.051'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( "UPDATE borrowers SET login_attempts = ? WHERE login_attempts > ?", undef, C4::Context->preference('FailedLoginAttempts'), C4::Context->preference('FailedLoginAttempts') ); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 21336 - Reset login_attempts)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5