Update migration

This commit is contained in:
Daniel Supernault 2022-12-27 05:49:36 -07:00
parent 898911f9a9
commit bf86ed6ff7
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -16,7 +16,7 @@ return new class extends Migration
public function up()
{
Hashtag::withoutEvents(function() {
Hashtag::chunkById(50, function($hashtags) {
Hashtag::whereNotNull('cached_count')->chunkById(50, function($hashtags) {
foreach($hashtags as $hashtag) {
$count = DB::table('status_hashtags')->whereHashtagId($hashtag->id)->count();
$hashtag->cached_count = $count;