From e486abbab5b8896eee190f089b3bf421e97e2835 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 10 Nov 2014 14:17:40 +0100 Subject: [PATCH] Bug 10459: Borrowers should have a timestamp Content-Type: text/plain; charset=utf-8 This patch adds a timestamp column to the borrowers table in kohastructure and updatedatabase. A timestamp may be useful in synchronizing with external systems (among other reasons). Test plan: Run updatestructure on an existing database, or install a new one. Verify that the borrowers table has a timestamp now. Signed-off-by: Marcel de Rooy Tested updatestructure and running kohastructure.sql --- installer/data/mysql/kohastructure.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8c777f7..160ebfc 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -264,7 +264,8 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons `altcontactcountry` text default NULL, -- the country for the alternate contact for the patron/borrower `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on) - `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history + `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) UNIQUE KEY `cardnumber` (`cardnumber`), PRIMARY KEY `borrowernumber` (`borrowernumber`), KEY `categorycode` (`categorycode`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 30d5b9c..9eaebb1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9418,6 +9418,16 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } + +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q| +ALTER TABLE borrowers ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER privacy; + |); + print "Upgrade to $DBversion done (Bug 10459: Borrowers should have a timestamp)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.7.7.6