Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve tags when using SQLite #106

Closed
hackel opened this issue Apr 24, 2018 · 2 comments
Closed

Unable to retrieve tags when using SQLite #106

hackel opened this issue Apr 24, 2018 · 2 comments

Comments

@hackel
Copy link

hackel commented Apr 24, 2018

This could be considered more of a Laravel issue, but I thought I would raise it here in case it seemed worthwhile to work-around it. Currently, Laravel treats sqlite like any other PDO database, however sqlite doesn't support the "->" shorthand syntax for JSON columns, which means Tag::findFromString fails.

e.g.: This fails:
Tag::findFromString('asdf') => null
SQL: select * from "tags" where "name->en" = ? and "type" is null limit 1

Workaround:
Tag::whereRaw("json_extract(`name`, '$.en') = 'asdf'")->first() => Tag object
SQL: select * from "tags" where json_extract(`name`, '$.en') = 'asdf'

Unfortunately this is causing my integration tests that use an in-memory sqlite database to fail.

@freekmurze
Copy link
Member

This issue is not caused by this package. Please open up an issue at Laravel.

@staudenmeir
Copy link

Laravel 5.6.35 supports JSON queries on SQLite (laravel/framework#25328).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants