Skip to content

Commit 5a06e0e

Browse files
committed
handle soft delete enabeld first, force order by
1 parent 1a00d45 commit 5a06e0e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

system/Model.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,13 @@ public function first()
473473

474474
// Some databases, like PostgreSQL, need order
475475
// information to consistently return correct results when there is group by
476-
if (! empty($this->QBGroupBy) && empty($builder->QBOrderBy) && ! empty($this->primaryKey))
476+
// except when soft delete is enabled
477+
if (empty($builder->QBOrderBy) && ! empty($this->primaryKey))
477478
{
478-
$builder->orderBy($this->table . '.' . $this->primaryKey, 'asc');
479+
if (! empty($this->QBGroupBy) || $this->tempUseSoftDeletes === true)
480+
{
481+
$builder->orderBy($this->table . '.' . $this->primaryKey, 'asc');
482+
}
479483
}
480484

481485
$row = $builder->limit(1, 0)

0 commit comments

Comments
 (0)