From 28e6e893694df29d1c93263752411857dcf4ecd3 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Wed, 15 Apr 2020 16:12:16 -0300 Subject: [PATCH] Bug 23816: Update kohastructure and atomic update --- installer/data/mysql/atomicupdate/bug_23816.perl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_23816.perl diff --git a/installer/data/mysql/atomicupdate/bug_23816.perl b/installer/data/mysql/atomicupdate/bug_23816.perl new file mode 100644 index 0000000000..6266f46bf1 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23816.perl @@ -0,0 +1,14 @@ +$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 97801a50e2..609953dbfe 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -324,6 +324,8 @@ 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 + `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 PRIMARY KEY (`categorycode`), UNIQUE KEY `categorycode` (`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.25.0