igaster/laravel_cities

LOWER not works with postgres

davidjoan opened this issue · 4 comments

Running some Apis not works,

...[2019-04-16 03:09:54] testing.ERROR: SQLSTATE[42883]: Undefined function: 7 ERROR: function lower(json) does not exist LINE 1: select * from "geo" where (LOWER(alternames) LIKE $1 or LOWE...

Works with casting
$query->whereRaw('LOWER(alternames::TEXT) LIKE ?', [$search]) ->orWhereRaw('LOWER(name) LIKE ?', [$search]);

Works changing alternames to text in the model

Thank you @davidjoan,

Actually, the json mysql type is not used in the package. An easy fix would be to write your own migration and change this column to text.

Here is the reference migration: https://github.com/igaster/laravel_cities/blob/master/src/migrations/2017_02_13_090952_geo.php

Works changing alternames to text in the model

Implemented!