Skip to content

Commit dc39572

Browse files
adaamzdg
authored andcommitted
Sqlite: fixed datetime column type
Sqlite stores datetime as integer/unix_timestamp, so handle it as unix timestamp. Sqlite: fixed datetime column type Sqlite stores datetime as integer/unix_timestamp, so handle it as unix timestamp.
1 parent b816407 commit dc39572

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Database/Drivers/SqliteDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public function getColumnTypes(\PDOStatement $statement)
277277
for ($col = 0; $col < $count; $col++) {
278278
$meta = $statement->getColumnMeta($col);
279279
if (isset($meta['sqlite:decl_type'])) {
280-
if ($meta['sqlite:decl_type'] === 'DATE') {
280+
if (in_array($meta['sqlite:decl_type'], ['DATE', 'DATETIME'], TRUE)) {
281281
$types[$meta['name']] = Nette\Database\IStructure::FIELD_UNIX_TIMESTAMP;
282282
} else {
283283
$types[$meta['name']] = Nette\Database\Helpers::detectType($meta['sqlite:decl_type']);

0 commit comments

Comments
 (0)