add DB migration

This commit is contained in:
ayntk-ai 2024-08-10 00:13:17 +02:00
parent 27a15138b7
commit b738e5c000
No known key found for this signature in database

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddServerCleanupEnabledToServerSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('server_settings', function (Blueprint $table) {
$table->boolean('force_server_cleanup')->default(false);
$table->string('server_cleanup_cron')->default('*/10 * * * *');
$table->integer('server_cleanup_threshold')->default(80);
// Remove old columns
$table->dropColumn('is_force_cleanup_enabled');
$table->dropColumn('cleanup_after_percentage');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('force_server_cleanup');
$table->dropColumn('server_cleanup_cron');
$table->dropColumn('server_cleanup_threshold');
// Add back old columns
$table->boolean('is_force_cleanup_enabled')->default(false);
$table->integer('cleanup_after_percentage')->default(80);
});
}
}