From fbc466f93b3cd6900b8313db3314d2f1b946abdf Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 21 Feb 2017 12:16:03 +0000 Subject: [PATCH] Bug 15707: Switch datetimes to timestamps Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- Koha/Library/Group.pm | 4 +--- installer/data/mysql/atomicupdate/library_groups.sql | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Koha/Library/Group.pm b/Koha/Library/Group.pm index cd538995a0..43291e8ab5 100644 --- a/Koha/Library/Group.pm +++ b/Koha/Library/Group.pm @@ -118,9 +118,7 @@ sub libraries_not_direct_children { sub store { my ($self) = @_; - my $now = dt_from_string; - $self->updated_on($now); - $self->created_on($now) unless $self->in_storage(); + $self->created_on( dt_from_string() ) unless $self->in_storage(); return $self->SUPER::store(@_); } diff --git a/installer/data/mysql/atomicupdate/library_groups.sql b/installer/data/mysql/atomicupdate/library_groups.sql index d6d34251e3..ba30eec4d6 100644 --- a/installer/data/mysql/atomicupdate/library_groups.sql +++ b/installer/data/mysql/atomicupdate/library_groups.sql @@ -4,8 +4,8 @@ CREATE TABLE library_groups ( branchcode VARCHAR(10) NULL DEFAULT NULL, -- The branchcode of a branch belonging to the parent group title VARCHAR(100) NULL DEFAULT NULL, -- Short description of the goup description TEXT NULL DEFAULT NULL, -- Longer explanation of the group, if necessary - created_on DATETIME NOT NULL, -- Date and time of creation - updated_on DATETIME NULL DEFAULT NULL, -- Date and time of last + created_on TIMESTAMP NULL, -- Date and time of creation + updated_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Date and time of last PRIMARY KEY id ( id ), FOREIGN KEY (parent_id) REFERENCES library_groups(id) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON UPDATE CASCADE ON DELETE CASCADE -- 2.39.5