mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 16:23:16 +00:00
Update FixLikes command, fix postgres support
This commit is contained in:
parent
62885fab44
commit
771f9c4615
1 changed files with 2 additions and 2 deletions
|
@ -40,7 +40,7 @@ class FixLikes extends Command
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$chunk = 100;
|
$chunk = 100;
|
||||||
$limit = Like::groupBy('status_id')->get()->count();
|
$limit = Like::select('status_id')->groupBy('status_id')->get()->count();
|
||||||
|
|
||||||
if($limit > 1000) {
|
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) {
|
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) {
|
||||||
|
@ -56,7 +56,7 @@ class FixLikes extends Command
|
||||||
$bar->start();
|
$bar->start();
|
||||||
|
|
||||||
Like::selectRaw('count(id) as count, status_id')
|
Like::selectRaw('count(id) as count, status_id')
|
||||||
->groupBy('status_id')
|
->groupBy(['status_id','id'])
|
||||||
->chunk($chunk, function($likes) use($bar) {
|
->chunk($chunk, function($likes) use($bar) {
|
||||||
foreach($likes as $like) {
|
foreach($likes as $like) {
|
||||||
$s = Status::find($like['status_id']);
|
$s = Status::find($like['status_id']);
|
||||||
|
|
Loading…
Reference in a new issue