From 49a39307e0b156ca3681aa382bbf28f5082b3157 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 Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Tomas Cohen Arazi Signed-off-by: Fridolin Somers --- .../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 6487ec1fcc..488f1439c8 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1421,6 +1421,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', @@ -1648,6 +1649,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', @@ -2431,6 +2433,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.39.5