This breaks literally the entire panel.
This commit is contained in:
parent
344c1a9885
commit
df87ea0867
88 changed files with 1205 additions and 992 deletions
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\ServiceOption;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
@ -13,31 +12,6 @@ class DeleteServiceExecutableOption extends Migration
|
|||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
// Attempt to fix any startup commands for servers
|
||||
// that we possibly can. Also set new containers.
|
||||
foreach (ServiceOption::with('servers')->get() as $option) {
|
||||
$option->servers->each(function ($s) use ($option) {
|
||||
$prepend = $option->display_executable;
|
||||
$prepend = ($prepend === './ShooterGameServer') ? './ShooterGame/Binaries/Linux/ShooterGameServer' : $prepend;
|
||||
$prepend = ($prepend === 'TerrariaServer.exe') ? 'mono TerrariaServer.exe' : $prepend;
|
||||
|
||||
$s->startup = $prepend . ' ' . $s->startup;
|
||||
|
||||
$container = $s->container;
|
||||
if (starts_with($container, 'quay.io/pterodactyl/minecraft')) {
|
||||
$s->container = 'quay.io/pterodactyl/core:java';
|
||||
} elseif (starts_with($container, 'quay.io/pterodactyl/srcds')) {
|
||||
$s->container = 'quay.io/pterodactyl/core:source';
|
||||
} elseif (starts_with($container, 'quay.io/pterodactyl/voice')) {
|
||||
$s->container = 'quay.io/pterodactyl/core:glibc';
|
||||
} elseif (starts_with($container, 'quay.io/pterodactyl/terraria')) {
|
||||
$s->container = 'quay.io/pterodactyl/core:mono';
|
||||
}
|
||||
|
||||
$s->save();
|
||||
});
|
||||
}
|
||||
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('file', 'folder');
|
||||
$table->dropColumn('executable');
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
use Pterodactyl\Models\Service;
|
||||
use Pterodactyl\Models\ServiceOption;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MigrateToNewServiceSystem extends Migration
|
||||
|
@ -18,12 +16,12 @@ class MigrateToNewServiceSystem extends Migration
|
|||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
$service = Service::where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
|
||||
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
|
||||
if (! $service) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = ServiceOption::where('service_id', $service->id)->get();
|
||||
$options = DB::table('service_options')->where('service_id', $service->id)->get();
|
||||
$options->each(function ($item) use ($options) {
|
||||
if ($item->tag === 'srcds' && $item->name === 'Insurgency') {
|
||||
$item->tag = 'insurgency';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Pterodactyl\Models\ServiceVariable;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
|
@ -17,7 +16,7 @@ class ChangeServiceVariablesValidationRules extends Migration
|
|||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
foreach (ServiceVariable::all() as $variable) {
|
||||
foreach (DB::table('service_variables')->get() as $variable) {
|
||||
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->rules;
|
||||
$variable->save();
|
||||
}
|
||||
|
@ -39,7 +38,7 @@ class ChangeServiceVariablesValidationRules extends Migration
|
|||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
foreach (ServiceVariable::all() as $variable) {
|
||||
foreach (DB::table('service_variables')->get() as $variable) {
|
||||
$variable->regex = str_replace(['required|regex:', 'regex:'], '', $variable->regex);
|
||||
$variable->save();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\Service;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
@ -93,11 +92,11 @@ EOF;
|
|||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
Service::where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', '!=', 'minecraft')->update([
|
||||
DB::table('services')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', '!=', 'minecraft')->update([
|
||||
'index_file' => $this->default,
|
||||
]);
|
||||
|
||||
Service::where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', 'minecraft')->update([
|
||||
DB::table('services')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('folder', 'minecraft')->update([
|
||||
'index_file' => $this->default_mc,
|
||||
]);
|
||||
});
|
||||
|
|
|
@ -15,6 +15,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
|
|||
{
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->char('uuid', 36)->after('id');
|
||||
$table->string('author')->after('service_id');
|
||||
$table->dropColumn('tag');
|
||||
});
|
||||
|
||||
|
@ -25,6 +26,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
|
|||
'services.author AS service_author',
|
||||
])->join('services', 'services.id', '=', 'service_options.service_id')->get()->each(function ($option) {
|
||||
DB::table('service_options')->where('id', $option->id)->update([
|
||||
'author' => $option->service_author,
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
]);
|
||||
});
|
||||
|
@ -42,6 +44,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration
|
|||
{
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropColumn('uuid');
|
||||
$table->dropColumn('author');
|
||||
$table->string('tag');
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ServicesToNestsConversion extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::rename('services', 'nests');
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign(['service_id']);
|
||||
$table->renameColumn('service_id', 'nest_id');
|
||||
|
||||
$table->foreign('nest_id')->references('id')->on('nests');
|
||||
});
|
||||
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign(['service_id']);
|
||||
$table->renameColumn('service_id', 'nest_id');
|
||||
|
||||
$table->foreign('nest_id')->references('id')->on('nests')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::rename('nests', 'services');
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign(['nest_id']);
|
||||
$table->renameColumn('nest_id', 'service_id');
|
||||
|
||||
$table->foreign('service_id')->references('id')->on('services');
|
||||
});
|
||||
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign(['nest_id']);
|
||||
$table->renameColumn('nest_id', 'service_id');
|
||||
|
||||
$table->foreign('service_id')->references('id')->on('services')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ServiceOptionsToEggsConversion extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign(['config_from']);
|
||||
$table->dropForeign(['copy_script_from']);
|
||||
});
|
||||
|
||||
Schema::rename('service_options', 'eggs');
|
||||
|
||||
Schema::table('packs', function (Blueprint $table) {
|
||||
$table->dropForeign(['option_id']);
|
||||
$table->renameColumn('option_id', 'egg_id');
|
||||
|
||||
$table->foreign('egg_id')->references('id')->on('eggs')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign(['option_id']);
|
||||
$table->renameColumn('option_id', 'egg_id');
|
||||
|
||||
$table->foreign('egg_id')->references('id')->on('eggs');
|
||||
});
|
||||
|
||||
Schema::table('eggs', function (Blueprint $table) {
|
||||
$table->foreign('config_from')->references('id')->on('eggs')->onDelete('SET NULL');
|
||||
$table->foreign('copy_script_from')->references('id')->on('eggs')->onDelete('SET NULL');
|
||||
});
|
||||
|
||||
Schema::table('service_variables', function (Blueprint $table) {
|
||||
$table->dropForeign(['option_id']);
|
||||
$table->renameColumn('option_id', 'egg_id');
|
||||
|
||||
$table->foreign('egg_id')->references('id')->on('eggs')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::table('eggs', function (Blueprint $table) {
|
||||
$table->dropForeign(['config_from']);
|
||||
$table->dropForeign(['copy_script_from']);
|
||||
});
|
||||
|
||||
Schema::rename('eggs', 'service_options');
|
||||
|
||||
Schema::table('packs', function (Blueprint $table) {
|
||||
$table->dropForeign(['egg_id']);
|
||||
$table->renameColumn('egg_id', 'option_id');
|
||||
|
||||
$table->foreign('option_id')->references('id')->on('service_options')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign(['egg_id']);
|
||||
$table->renameColumn('egg_id', 'option_id');
|
||||
|
||||
$table->foreign('option_id')->references('id')->on('service_options');
|
||||
});
|
||||
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->foreign('config_from')->references('id')->on('service_options')->onDelete('SET NULL');
|
||||
$table->foreign('copy_script_from')->references('id')->on('service_options')->onDelete('SET NULL');
|
||||
});
|
||||
|
||||
Schema::table('service_variables', function (Blueprint $table) {
|
||||
$table->dropForeign(['egg_id']);
|
||||
$table->renameColumn('egg_id', 'option_id');
|
||||
|
||||
$table->foreign('option_id')->references('id')->on('options')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ServiceVariablesToEggVariablesConversion extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::rename('service_variables', 'egg_variables');
|
||||
|
||||
Schema::table('server_variables', function (Blueprint $table) {
|
||||
$table->dropForeign(['variable_id']);
|
||||
|
||||
$table->foreign('variable_id')->references('id')->on('egg_variables')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
|
||||
Schema::rename('egg_variables', 'service_variables');
|
||||
|
||||
Schema::table('server_variables', function (Blueprint $table) {
|
||||
$table->dropForeign(['variable_id']);
|
||||
|
||||
$table->foreign('variable_id')->references('id')->on('service_variables')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
Reference in a new issue