@@ -, +, @@ --- .../bug_23486_set_lastseen_default.pl | 15 +++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_23486_set_lastseen_default.pl --- a/installer/data/mysql/atomicupdate/bug_23486_set_lastseen_default.pl +++ a/installer/data/mysql/atomicupdate/bug_23486_set_lastseen_default.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "23486", + description => "Default lastseen to current timestamp", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + ALTER TABLE borrowers CHANGE lastseen + lastseen datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)' + }); + say $out "Update lastseen colum to default to current timestamp"; + }, +}; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1457,7 +1457,7 @@ CREATE TABLE `borrowers` ( `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts', `checkprevcheckout` varchar(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to category setting if ''inherit''.', `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'time of last change could be useful for synchronization with external systems (among others)', - `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)', + `lastseen` datetime DEFAULT current_timestamp() COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)', `lang` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron', `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps', `overdrive_auth_token` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'persist OverDrive auth token', --