View | Details | Raw Unified | Return to bug 23486
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_23486_set_lastseen_default.pl (+19 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "23486",
5
    description => "Default lastseen to current timestamp",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            UPDATE borrowers SET lastseen = IFNULL(dateenrolled,updated_on) WHERE lastseen IS NULL
11
        });
12
        say $out "Update any borrowers with a NULL lastseen to their date enrolled, or their updated_on date if date enrolled is null";
13
        $dbh->do(q{
14
            ALTER TABLE borrowers CHANGE lastseen
15
            lastseen datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)'
16
        });
17
        say $out "Update lastseen colum to default to current timestamp";
18
    },
19
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +1 lines)
Lines 1488-1494 CREATE TABLE `borrowers` ( Link Here
1488
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1488
  `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'controls if relatives can see this patron''s checkouts',
1489
  `checkprevcheckout` varchar(7) 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''.',
1489
  `checkprevcheckout` varchar(7) 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''.',
1490
  `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)',
1490
  `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)',
1491
  `lastseen` datetime DEFAULT NULL COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1491
  `lastseen` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'last time a patron has been seen (connected at the OPAC or staff interface)',
1492
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1492
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang to use to send notices to this patron',
1493
  `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1493
  `login_attempts` int(4) NOT NULL DEFAULT 0 COMMENT 'number of failed login attemps',
1494
  `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1494
  `overdrive_auth_token` mediumtext DEFAULT NULL COMMENT 'persist OverDrive auth token',
1495
- 

Return to bug 23486