Skip to content

Commit be51f3a

Browse files
committed
fix: docker names for main workers
1 parent dde7678 commit be51f3a

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Support\Facades\DB;
5+
6+
return new class extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*/
11+
public function up(): void
12+
{
13+
DB::query()->from('deployments')->orderBy('id', 'asc')->chunk(100, function ($deployments) {
14+
foreach ($deployments as $deployment) {
15+
$data = json_decode($deployment->data);
16+
17+
foreach ($data->processes as $process) {
18+
foreach ($process->workers as $worker) {
19+
$worker->dockerName = $process->dockerName;
20+
}
21+
}
22+
23+
DB::query()->from('deployments')->where('id', $deployment->id)->update([
24+
'data' => json_encode($data),
25+
]);
26+
}
27+
});
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*/
33+
public function down(): void
34+
{
35+
//
36+
}
37+
};

0 commit comments

Comments
 (0)