feat: Update server settings metrics history days to 7

This commit is contained in:
Andras Bacsai
2024-06-26 13:59:41 +02:00
parent 07508df8fd
commit 4fb37054df

View File

@@ -1,6 +1,7 @@
<?php <?php
use App\Models\EnvironmentVariable; use App\Models\EnvironmentVariable;
use App\Models\Server;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
@@ -30,6 +31,14 @@ return new class extends Migration
Schema::table('environment_variables', function (Blueprint $table) { Schema::table('environment_variables', function (Blueprint $table) {
$table->string('uuid')->nullable(false)->change(); $table->string('uuid')->nullable(false)->change();
}); });
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('metrics_history_days')->default(7)->change();
});
Server::all()->each(function (Server $server) {
$server->settings->update([
'metrics_history_days' => 7,
]);
});
} }
/** /**
@@ -45,6 +54,13 @@ return new class extends Migration
Schema::table('environment_variables', function (Blueprint $table) { Schema::table('environment_variables', function (Blueprint $table) {
$table->dropColumn('uuid'); $table->dropColumn('uuid');
}); });
Schema::table('server_settings', function (Blueprint $table) {
$table->integer('metrics_history_days')->default(30)->change();
});
Server::all()->each(function (Server $server) {
$server->settings->update([
'metrics_history_days' => 30,
]);
});
} }
}; };