diff --git a/database/migrations/2023_05_03_042219_fix_postgres_hashtags.php b/database/migrations/2023_05_03_042219_fix_postgres_hashtags.php new file mode 100644 index 000000000..1d4b1e820 --- /dev/null +++ b/database/migrations/2023_05_03_042219_fix_postgres_hashtags.php @@ -0,0 +1,46 @@ +name)->orderBy('id')->get(); + if($dups->count() === 1) { + continue; + } + + $first = $dups->shift(); + $dups->each(function($dup) use($first) { + StatusHashtag::whereHashtagId($dup->id)->update(['hashtag_id' => $first->id]); + $dup->delete(); + }); + } + + Cache::clear(); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +};