From 0ce52241483e6ccd6d713feb74eff08e57288317 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 16 Aug 2022 04:31:09 +0000 Subject: [PATCH] Change stored date to DATETIME --- lib/Db/Util.php | 5 +++-- lib/Migration/Version000000Date20220812163631.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Db/Util.php b/lib/Db/Util.php index 9a1c05c4..a7d3dcdb 100644 --- a/lib/Db/Util.php +++ b/lib/Db/Util.php @@ -55,6 +55,7 @@ class Util { $fileId = $file->getId(); $dateTaken = $this->getDateTaken($file); $dayId = floor($dateTaken / 86400); + $dateTaken = gmdate('Y-m-d H:i:s', $dateTaken); $sql = 'INSERT INTO oc_polaroid (day_id, date_taken, is_video, user_id, file_id) @@ -66,9 +67,9 @@ class Util { $user, $fileId, $dayId, $dateTaken, $is_video, ], [ - \PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_BOOL, + \PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_BOOL, \PDO::PARAM_STR, \PDO::PARAM_INT, - \PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_BOOL, + \PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_BOOL, ]); } diff --git a/lib/Migration/Version000000Date20220812163631.php b/lib/Migration/Version000000Date20220812163631.php index c06e1a04..fba2d50b 100644 --- a/lib/Migration/Version000000Date20220812163631.php +++ b/lib/Migration/Version000000Date20220812163631.php @@ -30,7 +30,7 @@ 'notnull' => true, 'length' => 200, ]); - $table->addColumn('date_taken', Types::INTEGER, [ + $table->addColumn('date_taken', Types::DATETIME, [ 'notnull' => false, ]); $table->addColumn('file_id', Types::BIGINT, [