Phpunit detects an error on my query
SQLSTATE[HY000]: General error: 1 near "(": syntax error (SQL:
select * from "forms"
where "factual_checkout_at" is null
and "plan_checkout_at" >= ?
and CONCAT(UPPER(RIGHT(name, 3)), id) = ?
and "forms"."deleted_at" is null and "forms"."type" in (?, ?, ?) limit 1
)
I'm trying to get a form with given code. (In this case I combine last 3 digit of user's name with their id).
The problem is, my app runs well with this query, the transaction goes well, but not on phpunit.
Here's the method to get that form (laravel):
$form = Form::whereNull('factual_checkout_at')
->where('plan_checkout_at', '>=', Carbon::today())
->whereRaw('CONCAT(UPPER(RIGHT(name, 3)), id) = ?', $code)
->firstOrFail();
return new FormResource($form);
What did I miss?
Thanks in advance!
CONCATkeyword is not available for SQLite.