From f3c199ac140a29fa10c16cbba7507a1c2e34dc34 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 9 Sep 2020 13:13:45 +0000 Subject: [PATCH] Bug 23816: DBRev 20.06.00.037 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- installer/data/mysql/atomicupdate/bug_23816.perl | 14 -------------- installer/data/mysql/kohastructure.sql | 2 +- installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ 4 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23816.perl diff --git a/Koha.pm b/Koha.pm index abf5adf1f7..faa3447384 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 = "20.06.00.036"; +$VERSION = "20.06.00.037"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_23816.perl b/installer/data/mysql/atomicupdate/bug_23816.perl deleted file mode 100644 index 6266f46bf1..0000000000 --- a/installer/data/mysql/atomicupdate/bug_23816.perl +++ /dev/null @@ -1,14 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - # you can use $dbh here like: - # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); - if( !column_exists( 'categories', 'min_password_length' ) ) { - $dbh->do("ALTER TABLE categories ADD COLUMN `min_password_length` smallint(6) NULL DEFAULT NULL AFTER `change_password` -- set minimum password length for patrons in this category"); - } - if( !column_exists( 'categories', 'require_strong_password' ) ) { - $dbh->do("ALTER TABLE categories ADD COLUMN `require_strong_password` TINYINT(1) NULL DEFAULT NULL AFTER `min_password_length` -- set required password strength for patrons in this category"); - } - - # Always end with this (adjust the bug info) - NewVersion( $DBversion, 23816, "Add min_password_length and require_strong_password columns in categories table"); -} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fdd0d89595..9dff2f804b 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -327,9 +327,9 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'. `reset_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can do the password reset flow, `change_password` TINYINT(1) NULL DEFAULT NULL, -- if patrons of this category can change their passwords in the OAPC - `exclude_from_local_holds_priority` tinyint(1) default NULL, -- Exclude patrons of this category from local holds priority `min_password_length` smallint(6) NULL DEFAULT NULL, -- set minimum password length for patrons in this category `require_strong_password` TINYINT(1) NULL DEFAULT NULL, -- set required password strength for patrons in this category + `exclude_from_local_holds_priority` tinyint(1) default NULL, -- Exclude patrons of this category from local holds priority PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8a4f29aad2..e632d39c27 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -22777,6 +22777,18 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 20168, "Update OPACSearchForTitleIn to work with Bootstrap 4"); } +$DBversion = '20.06.00.037'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'categories', 'min_password_length' ) ) { + $dbh->do("ALTER TABLE categories ADD COLUMN `min_password_length` smallint(6) NULL DEFAULT NULL AFTER `change_password` -- set minimum password length for patrons in this category"); + } + if( !column_exists( 'categories', 'require_strong_password' ) ) { + $dbh->do("ALTER TABLE categories ADD COLUMN `require_strong_password` TINYINT(1) NULL DEFAULT NULL AFTER `min_password_length` -- set required password strength for patrons in this category"); + } + + NewVersion( $DBversion, 23816, "Add min_password_length and require_strong_password columns in categories table"); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5