Skip to content

Commit

Permalink
Cast to bigint on PostgreSQL to avoid issues with big integer IDs (#40)
Browse files Browse the repository at this point in the history
* Cast to bigint on postgresql to avoid issues with big integer IDs

* Fix tests for sqlsrv

* Reversed it by mistake

* Remove leftover

* Revert changes to tests

(cherry picked from commit 3bb8083)
  • Loading branch information
nikazooz authored and staudenmeir committed Nov 28, 2020
1 parent 2e7dc72 commit e6c764f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Relations/Postgres/IsPostgresRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function jsonColumn(Builder $query, Model $model, $column, $key)
$sql = $query->getQuery()->getGrammar()->wrap($column);

if ($model->getKeyName() === $key && in_array($model->getKeyType(), ['int', 'integer'])) {
$sql = '('.$sql.')::int';
$sql = '('.$sql.')::bigint';
}

if ($model->hasCast($key) && $model->getCasts()[$key] === 'uuid') {
Expand Down

0 comments on commit e6c764f

Please sign in to comment.