2022_12_31_034627_fix_account_status_deletes.php 572 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. use App\Status;
  6. use App\Jobs\StatusPipeline\StatusDelete;
  7. return new class extends Migration
  8. {
  9. /**
  10. * Run the migrations.
  11. *
  12. * @return void
  13. */
  14. public function up()
  15. {
  16. Status::doesntHave('profile')->get()->each(function($status) { StatusDelete::dispatch($status); });
  17. }
  18. /**
  19. * Reverse the migrations.
  20. *
  21. * @return void
  22. */
  23. public function down()
  24. {
  25. //
  26. }
  27. };