Bug 29924: Database updates
authorNick Clemens <nick@bywatersolutions.com>
Fri, 21 Jan 2022 16:59:41 +0000 (16:59 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 6 May 2022 20:33:09 +0000 (10:33 -1000)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
installer/data/mysql/atomicupdate/password_expire.pl [new file with mode: 0755]
installer/data/mysql/kohastructure.sql

diff --git a/installer/data/mysql/atomicupdate/password_expire.pl b/installer/data/mysql/atomicupdate/password_expire.pl
new file mode 100755 (executable)
index 0000000..2982685
--- /dev/null
@@ -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";
+        }
+    },
+};
index 6487ec1..488f143 100644 (file)
@@ -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',