You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQLSTATE[42803]: Grouping error: 7 ERROR: column "audits.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ... null and "audits"."auditable_type" = $2 order by "created_a...
^ (SQL: select count(*) as aggregate from "audits" where "audits"."auditable_id" = 2 and "audits"."auditable_id" is not null and "audits"."auditable_type" = App\Models\User order by "created_at" desc)
Is it a bugs ?
The text was updated successfully, but these errors were encountered:
I think this is a bugs in the: src/Driver/Database.php
...
$total = $model->audits()->count();
...
src/Auditable.php
...
public function audits()
{
return $this->morphMany(AuditModel::class, 'auditable')
->orderBy('created_at', 'DESC');
}
...
Both of them make an SQL Error in Pgsql:
SQLSTATE[42803]: Grouping error: 7 ERROR: column "audits.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ... null and "audits"."auditable_type" = $2 order by "created_a...
Today I had some time to look into this and I managed to replicate the issue. Like you pointed out, it's due to the orderBy('created_at', 'DESC') in the audits() relation method in the Auditable trait.
I found a similar issue, which lead me to the solution.
I got SQL Error like this:
Is it a bugs ?
The text was updated successfully, but these errors were encountered: