Change stored date to DATETIME

pull/37/head
Varun Patil 2022-08-16 04:31:09 +00:00
parent 37002f1721
commit 0ce5224148
2 changed files with 4 additions and 3 deletions

View File

@ -55,6 +55,7 @@ class Util {
$fileId = $file->getId(); $fileId = $file->getId();
$dateTaken = $this->getDateTaken($file); $dateTaken = $this->getDateTaken($file);
$dayId = floor($dateTaken / 86400); $dayId = floor($dateTaken / 86400);
$dateTaken = gmdate('Y-m-d H:i:s', $dateTaken);
$sql = 'INSERT $sql = 'INSERT
INTO oc_polaroid (day_id, date_taken, is_video, user_id, file_id) INTO oc_polaroid (day_id, date_taken, is_video, user_id, file_id)
@ -66,9 +67,9 @@ class Util {
$user, $fileId, $user, $fileId,
$dayId, $dateTaken, $is_video, $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_STR, \PDO::PARAM_INT,
\PDO::PARAM_INT, \PDO::PARAM_INT, \PDO::PARAM_BOOL, \PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_BOOL,
]); ]);
} }

View File

@ -30,7 +30,7 @@
'notnull' => true, 'notnull' => true,
'length' => 200, 'length' => 200,
]); ]);
$table->addColumn('date_taken', Types::INTEGER, [ $table->addColumn('date_taken', Types::DATETIME, [
'notnull' => false, 'notnull' => false,
]); ]);
$table->addColumn('file_id', Types::BIGINT, [ $table->addColumn('file_id', Types::BIGINT, [