mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-27 18:43:45 +02:00
Remove suspended & installing fields, replace with single status field
This commit is contained in:
@@ -27,14 +27,13 @@ $factory->define(Pterodactyl\Models\Server::class, function (Faker $faker) {
|
||||
'name' => $faker->firstName,
|
||||
'description' => implode(' ', $faker->sentences()),
|
||||
'skip_scripts' => 0,
|
||||
'suspended' => 0,
|
||||
'status' => null,
|
||||
'memory' => 512,
|
||||
'swap' => 0,
|
||||
'disk' => 512,
|
||||
'io' => 500,
|
||||
'cpu' => 0,
|
||||
'oom_disabled' => 0,
|
||||
'installed' => 1,
|
||||
'database_limit' => null,
|
||||
'allocation_limit' => null,
|
||||
'created_at' => Carbon::now(),
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddGenericServerStatusColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->string('status')->nullable()->after('description');
|
||||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
DB::update('UPDATE servers SET `status` = \'suspended\' WHERE `suspended` = 1');
|
||||
DB::update('UPDATE servers SET `status` = \'installing\' WHERE `installed` = 0');
|
||||
DB::update('UPDATE servers SET `status` = \'install_failed\' WHERE `installed` = 2');
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('suspended');
|
||||
$table->dropColumn('installed');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('suspended')->default(0);
|
||||
$table->unsignedTinyInteger('installed')->default(0);
|
||||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
DB::update('UPDATE servers SET `suspended` = 1 WHERE `status` = \'suspended\'');
|
||||
DB::update('UPDATE servers SET `installed` = 1 WHERE `status` IS NULL');
|
||||
DB::update('UPDATE servers SET `installed` = 2 WHERE `status` = \'install_failed\'');
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('status');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user