refactor: Update cleanup schedule to run daily at midnight

This commit is contained in:
Andras Bacsai
2024-09-07 20:56:52 +02:00
parent 5fb560dbbf
commit 9861ad4045

View File

@@ -0,0 +1,26 @@
<?php
use App\Models\ServerSetting;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$serverSettings = ServerSetting::all();
foreach ($serverSettings as $serverSetting) {
if ($serverSetting->force_docker_cleanup && $serverSetting->docker_cleanup_frequency === '*/10 * * * *') {
$serverSetting->docker_cleanup_frequency = '0 0 * * *';
$serverSetting->save();
}
}
}
/**
* Reverse the migrations.
*/
public function down(): void {}
};