app(server): rename oom_disabled
to oom_killer
and invert existing values
This commit is contained in:
parent
450fba00bc
commit
7665eea14d
16 changed files with 63 additions and 256 deletions
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class () extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->tinyInteger('oom_killer')->unsigned()->default(1)->after('oom_disabled');
|
||||
});
|
||||
|
||||
DB::table('servers')->select(['id', 'oom_disabled'])->cursor()->each(function ($server) {
|
||||
DB::table('servers')->where('id', $server->id)->update(['oom_killer' => !$server->oom_disabled]);
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('oom_disabled');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->tinyInteger('oom_disabled')->unsigned()->default(0)->after('oom_killer');
|
||||
});
|
||||
|
||||
DB::table('servers')->select(['id', 'oom_killer'])->cursor()->each(function ($server) {
|
||||
DB::table('servers')->where('id', $server->id)->update(['oom_disabled' => !$server->oom_killer]);
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('oom_killer');
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue