Hey! Have you found any solution to your issue? I am kind of in the same situation.
Jul 30, 2017
2
Level 54
How do you test query to Json columns using sqlite?
Hey folks,
I came across an issue testing my queries using SQLite.
I need to perform query similar to
Product::whereRaw('features->"$.color"', 'red')->first();
This trows sintax error, but works with MySQL
Also, I tried the laravel docs way, like so:
Product::where('features->color', 'red')->first()
but I get null as the result but works with MySQL
The issue here is I need to add tests for it and SQLite throws a syntax error.
Error trace:
PDOException: SQLSTATE[HY000]: General error: 1 near ">": syntax error
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 near ">": syntax error (SQL: select * from "products" where features->"$.color" limit 1)
Please or to participate in this conversation.