From 89bc8996d8c7cac86d72dce132cdcad38112f6d0 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 21 Jan 2022 16:59:41 +0000 Subject: [PATCH] Bug 29924: Database updates Signed-off-by: Owen Leonard Signed-off-by: Bob Bennhoff --- .../mysql/atomicupdate/password_expire.pl | 30 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 3 ++ 2 files changed, 33 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/password_expire.pl diff --git a/installer/data/mysql/atomicupdate/password_expire.pl b/installer/data/mysql/atomicupdate/password_expire.pl new file mode 100755 index 0000000000..2982685b45 --- /dev/null +++ b/installer/data/mysql/atomicupdate/password_expire.pl @@ -0,0 +1,30 @@ +use Modern::Perl; + +return { + bug_number => "BUG_NUMBER", + description => "Add password expiration", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless( column_exists('categories', 'password_expiry_days') ){ + $dbh->do(q{ + ALTER TABLE categories ADD password_expiry_days SMALLINT(5) NULL DEFAULT NULL AFTER enrolmentperioddate + }); + say $out "Added password_expiry_days to categories"; + } + unless( column_exists('borrowers', 'password_expiration_date') ){ + $dbh->do(q{ + ALTER TABLE borrowers ADD password_expiration_date DATE NULL DEFAULT NULL AFTER dateexpiry + }); + # Print useful stuff here + say $out "Added password_expiration_date field to borrowers"; + } + unless( column_exists('deletedborrowers', 'password_expiration_date') ){ + $dbh->do(q{ + ALTER TABLE deletedborrowers ADD password_expiration_date DATE NULL DEFAULT NULL AFTER dateexpiry + }); + # Print useful stuff here + say $out "Added password_expiration_date field to borrowers"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 69b3613963..145eec6909 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1413,6 +1413,7 @@ CREATE TABLE `borrowers` ( `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category', `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)', `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)', + `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)', `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed', `gonenoaddress` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address', `lost` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card', @@ -1638,6 +1639,7 @@ CREATE TABLE `categories` ( `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'description of the patron category', `enrolmentperiod` smallint(6) DEFAULT NULL COMMENT 'number of months the patron is enrolled for (will be NULL if enrolmentperioddate is set)', `enrolmentperioddate` date DEFAULT NULL COMMENT 'date the patron is enrolled until (will be NULL if enrolmentperiod is set)', + `password_expiry_days` smallint(6) DEFAULT NULL COMMENT 'number of days after which the patron must reset their password', `upperagelimit` smallint(6) DEFAULT NULL COMMENT 'age limit for the patron', `dateofbirthrequired` tinyint(1) DEFAULT NULL COMMENT 'the minimum age required for the patron category', `finetype` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'unused in Koha', @@ -2421,6 +2423,7 @@ CREATE TABLE `deletedborrowers` ( `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'foreign key from the categories table, includes the code of the patron category', `dateenrolled` date DEFAULT NULL COMMENT 'date the patron was added to Koha (YYYY-MM-DD)', `dateexpiry` date DEFAULT NULL COMMENT 'date the patron/borrower''s card is set to expire (YYYY-MM-DD)', + `password_expiration_date` date DEFAULT NULL COMMENT 'date the patron/borrower''s password is set to expire (YYYY-MM-DD)', `date_renewed` date DEFAULT NULL COMMENT 'date the patron/borrower''s card was last renewed', `gonenoaddress` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having an unconfirmed address', `lost` tinyint(1) DEFAULT NULL COMMENT 'set to 1 for yes and 0 for no, flag to note that library marked this patron/borrower as having lost their card', -- 2.30.2