Skip to content

Commit c316473

Browse files
authored
Postgres should use timestamp not datetime in casts (#559)
1 parent 45bbb2b commit c316473

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/QueriesJsonColumns.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ protected function toCast(Field $field): string
6969
default => null,
7070
};
7171

72+
if ($cast === 'datetime' && str_contains(get_class($this->builder->getConnection()->getQueryGrammar()), 'PostgresGrammar')) {
73+
$cast = 'timestamp';
74+
}
75+
7276
// Date Ranges are dealt with a little bit differently.
7377
if ($field->type() === 'date' && $field->get('mode') === 'range') {
7478
$cast = "range_{$cast}";

0 commit comments

Comments
 (0)