Skip to content

Commit 20f23a0

Browse files
committed
db: add uuid column to failed_jobs table
Refer to <https://laravel.com/docs/8.x/upgrade#failed-jobs-table-batch-support> for more information regarding this change. Closes pterodactyl#4652
1 parent a27ea3d commit 20f23a0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\DB;
4+
use Illuminate\Support\Facades\Schema;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Database\Migrations\Migration;
7+
8+
return new class () extends Migration {
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('failed_jobs', function (Blueprint $table) {
15+
$table->string('uuid')->after('id')->nullable()->unique();
16+
});
17+
18+
DB::table('failed_jobs')->whereNull('uuid')->cursor()->each(function ($job) {
19+
DB::table('failed_jobs')
20+
->where('id', $job->id)
21+
->update(['uuid' => (string) Illuminate\Support\Str::uuid()]);
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*/
28+
public function down(): void
29+
{
30+
Schema::table('failed_jobs', function (Blueprint $table) {
31+
$table->dropColumn('uuid');
32+
});
33+
}
34+
};

0 commit comments

Comments
 (0)