diff --git a/migrations/2023_03_01_000000_update_queue_monitor_table.php b/migrations/2023_03_01_000000_update_queue_monitor_table.php deleted file mode 100644 index cce92113..00000000 --- a/migrations/2023_03_01_000000_update_queue_monitor_table.php +++ /dev/null @@ -1,63 +0,0 @@ -unsignedInteger('status')->default(MonitorStatus::RUNNING)->after('queue'); - }); - - $this->upgradeColumns(); - - Schema::table(config('queue-monitor.table'), function (Blueprint $table) { - $table->dropColumn(['failed', 'time_elapsed']); - }); - } - - public function upgradeColumns() - { - DB::table(config('queue-monitor.table'))->orderBy('id')->chunk(500, function (Collection $monitors) { - /** @var array> $matrix */ - $matrix = [ - MonitorStatus::RUNNING => [], - MonitorStatus::FAILED => [], - MonitorStatus::SUCCEEDED => [], - ]; - - foreach ($monitors as $monitor) { - /** @phpstan-ignore-next-line */ - if ($monitor->failed) { - $matrix[MonitorStatus::FAILED][] = $monitor; - } elseif (null !== $monitor->finished_at) { - $matrix[MonitorStatus::SUCCEEDED][] = $monitor; - } else { - $matrix[MonitorStatus::RUNNING][] = $monitor; - } - } - - foreach ($matrix as $status => $monitors) { - DB::table(config('queue-monitor.table')) - ->whereIn('id', array_map(fn (stdClass $monitor) => $monitor->id, $monitors)) - ->update(['status' => $status]); - } - }); - } - - public function down() - { - Schema::table(config('queue-monitor.table'), function (Blueprint $table) { - $table->dropColumn('status'); - - $table->float('time_elapsed', 12, 6)->nullable()->index(); - $table->boolean('failed')->default(false)->index(); - }); - } -} diff --git a/migrations/2023_05_03_144452_add_job_uuid_and_retried_to_queue_monitor_table.php b/migrations/2023_05_03_144452_add_job_uuid_and_retried_to_queue_monitor_table.php deleted file mode 100644 index 6171538c..00000000 --- a/migrations/2023_05_03_144452_add_job_uuid_and_retried_to_queue_monitor_table.php +++ /dev/null @@ -1,36 +0,0 @@ -uuid('job_uuid')->nullable()->after('id'); - $table->boolean('retried')->default(false)->after('attempt'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table(config('queue-monitor.table'), function (Blueprint $table) { - $table->dropColumn([ - 'job_uuid', - 'retried', - ]); - }); - } -} diff --git a/migrations/2023_07_13_144452_add_queued_at_column_to_queue_monitor_table.php b/migrations/2023_07_13_144452_add_queued_at_column_to_queue_monitor_table.php deleted file mode 100644 index aac0ee67..00000000 --- a/migrations/2023_07_13_144452_add_queued_at_column_to_queue_monitor_table.php +++ /dev/null @@ -1,32 +0,0 @@ -dateTime('queued_at')->nullable()->after('status'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table(config('queue-monitor.table'), function (Blueprint $table) { - $table->dropColumn('queued_at'); - }); - } -}