Skip to content

Commit c275634

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

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
if (! $worker->dockerName) {
20+
$worker->dockerName = $process->dockerName;
21+
}
22+
}
23+
}
24+
25+
DB::query()->from('deployments')->where('id', $deployment->id)->update([
26+
'data' => json_encode($data),
27+
]);
28+
}
29+
});
30+
}
31+
32+
/**
33+
* Reverse the migrations.
34+
*/
35+
public function down(): void
36+
{
37+
//
38+
}
39+
};

0 commit comments

Comments
 (0)