chore: Update docker cleanup schedule to run daily at midnight

This commit is contained in:
Andras Bacsai
2024-09-08 12:40:53 +02:00
parent 87ee3c511c
commit aa586a5677

View File

@@ -2,6 +2,8 @@
use App\Models\ServerSetting;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
@@ -10,6 +12,10 @@ return new class extends Migration
*/
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->string('docker_cleanup_frequency')->default('0 0 * * *')->change();
});
$serverSettings = ServerSetting::all();
foreach ($serverSettings as $serverSetting) {
if ($serverSetting->force_docker_cleanup && $serverSetting->docker_cleanup_frequency === '*/10 * * * *') {
@@ -22,5 +28,10 @@ return new class extends Migration
/**
* Reverse the migrations.
*/
public function down(): void {}
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->string('docker_cleanup_frequency')->default('*/10 * * * *')->change();
});
}
};