Skip to content

Commit

Permalink
Update FixLikes command, fix postgres support
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Oct 18, 2019
1 parent 62885fa commit 771f9c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Console/Commands/FixLikes.php
Expand Up @@ -40,7 +40,7 @@ public function __construct()
public function handle()
{
$chunk = 100;
$limit = Like::groupBy('status_id')->get()->count();
$limit = Like::select('status_id')->groupBy('status_id')->get()->count();

if($limit > 1000) {
if($this->confirm('We have found more than 1000 records to update, this may take a few moments. Are you sure you want to continue?') == false) {
Expand All @@ -56,7 +56,7 @@ public function handle()
$bar->start();

Like::selectRaw('count(id) as count, status_id')
->groupBy('status_id')
->groupBy(['status_id','id'])
->chunk($chunk, function($likes) use($bar) {
foreach($likes as $like) {
$s = Status::find($like['status_id']);
Expand Down

0 comments on commit 771f9c4

Please sign in to comment.