From 9b48cc364547e0f779f8369946fb8371c73b6e9f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 7 Nov 2014 13:23:19 +0100 Subject: [PATCH] Add creation_time and modification_time DB columns This will permits to know if non-updated data exist. --- lib/Hea/Library.pm | 4 ++-- schema.sql | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Hea/Library.pm b/lib/Hea/Library.pm index 21cd213..9df736d 100644 --- a/lib/Hea/Library.pm +++ b/lib/Hea/Library.pm @@ -25,8 +25,8 @@ sub create { my $dbh = Hea::Dbh::dbh; my $sql = q{ - INSERT INTO library (library_id, name, url, library_type, country) - VALUES (?, ?, ?, ?, ?) + INSERT INTO library (library_id, name, url, library_type, country, creation_time) + VALUES (?, ?, ?, ?, ?, NOW()) }; $library->{type} ||= ''; diff --git a/schema.sql b/schema.sql index a36d8ca..d57e0ed 100644 --- a/schema.sql +++ b/schema.sql @@ -5,7 +5,9 @@ CREATE TABLE library ( kohaversion VARCHAR(255) NULL DEFAULT NULL, url VARCHAR(255) NULL DEFAULT NULL, library_type VARCHAR(255) NOT NULL DEFAULT '', - country VARCHAR(255) NOT NULL DEFAULT '' + country VARCHAR(255) NOT NULL DEFAULT '', + creation_time TIMESTAMP NOT NULL, + modification_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS volumetry;