diff options
Diffstat (limited to 'app/Model/ProjectActivity.php')
-rw-r--r-- | app/Model/ProjectActivity.php | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php index 309bab9a..d3aeefe5 100644 --- a/app/Model/ProjectActivity.php +++ b/app/Model/ProjectActivity.php @@ -169,14 +169,8 @@ class ProjectActivity extends Base public function cleanup($max) { if ($this->db->table(self::TABLE)->count() > $max) { - $this->db->execute(' - DELETE FROM '.self::TABLE.' - WHERE id <= ( - SELECT id FROM ( - SELECT id FROM '.self::TABLE.' ORDER BY id DESC LIMIT 1 OFFSET '.$max.' - ) foo - )' - ); + $subquery = $this->db->table(self::TABLE)->desc('id')->limit($max)->columns('id'); + $this->db->table(self::TABLE)->notInSubquery('id', $subquery)->remove(); } } |