File: //var/www/quadcode/database/migrations/2025_03_12_150919_add_uuid_to_failed_jobs_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up()
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->string('uuid')->nullable()->after('id');
});
DB::table('failed_jobs')->whereNull('uuid')->get()->each(function ($job) {
DB::table('failed_jobs')->where('id', $job->id)->update(['uuid' => (string) Str::uuid()]);
});
Schema::table('failed_jobs', function (Blueprint $table) {
$table->string('uuid')->unique()->after('id')->change();
});
}
public function down()
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->dropColumn('uuid');
});
}
};