Merge branch 'develop' into feature/option-scripts
# Conflicts: # app/Http/Routes/AdminRoutes.php # app/Http/Routes/DaemonRoutes.php # app/Models/ServiceOption.php
This commit is contained in:
commit
8d24e5f168
683 changed files with 8854 additions and 12362 deletions
|
@ -29,6 +29,6 @@ class AddAllocationsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExsits('allocations');
|
||||
Schema::dropIfExists('allocations');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ class CreateFailedJobsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('failed_jobs');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,6 @@ class CreateJobsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('jobs');
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@ class AddServerVariables extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('server_variables', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
Schema::dropIfExists('server_variables');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ class AddServiceOptions extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExsits('service_options');
|
||||
Schema::dropIfExists('service_options');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,14 +32,11 @@ class AddForeignServerVariables extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('server_variables', function (Blueprint $table) {
|
||||
$table->dropForeign('server_variables_server_id_foreign');
|
||||
$table->dropForeign('server_variables_variable_id_foreign');
|
||||
|
||||
$table->dropIndex('server_variables_server_id_foreign');
|
||||
$table->dropIndex('server_variables_variable_id_foreign');
|
||||
$table->dropForeign(['server_id']);
|
||||
$table->dropForeign(['variable_id']);
|
||||
});
|
||||
|
||||
DB::statement('ALTER TABLE allocations
|
||||
DB::statement('ALTER TABLE server_variables
|
||||
MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL,
|
||||
MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL
|
||||
');
|
||||
|
|
|
@ -26,11 +26,7 @@ class AddForeignTasks extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropForeign('tasks_server_foreign');
|
||||
$table->dropForeign('tasks_server_foreign');
|
||||
|
||||
$table->dropIndex('tasks_server_foreign');
|
||||
$table->dropIndex('tasks_server_foreign');
|
||||
$table->dropForeign(['server']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ class AddPackColumn extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign('servers_pack_foreign');
|
||||
$table->dropIndex('servers_pack_foreign');
|
||||
$table->dropForeign(['pack']);
|
||||
$table->dropColumn('pack');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ class UpdateColumnNames extends Migration
|
|||
$table->foreign('allocation_id')->references('id')->on('allocations');
|
||||
$table->foreign('service_id')->references('id')->on('services');
|
||||
$table->foreign('option_id')->references('id')->on('service_options');
|
||||
|
||||
// Pack ID was forgotten until multiple releases later, therefore it is
|
||||
// contained in '2017_03_18_204953_AddForeignKeyToPacks'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,19 +54,11 @@ class UpdateColumnNames extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign('servers_node_id_foreign');
|
||||
$table->dropForeign('servers_owner_id_foreign');
|
||||
$table->dropForeign('servers_allocation_id_foreign');
|
||||
$table->dropForeign('servers_service_id_foreign');
|
||||
$table->dropForeign('servers_option_id_foreign');
|
||||
$table->dropForeign('servers_pack_id_foreign');
|
||||
|
||||
$table->dropIndex('servers_node_id_foreign');
|
||||
$table->dropIndex('servers_owner_id_foreign');
|
||||
$table->dropIndex('servers_allocation_id_foreign');
|
||||
$table->dropIndex('servers_service_id_foreign');
|
||||
$table->dropIndex('servers_option_id_foreign');
|
||||
$table->dropIndex('servers_pack_id_foreign');
|
||||
$table->dropForeign(['node_id']);
|
||||
$table->dropForeign(['owner_id']);
|
||||
$table->dropForeign(['allocation_id']);
|
||||
$table->dropForeign(['service_id']);
|
||||
$table->dropForeign(['option_id']);
|
||||
|
||||
$table->renameColumn('node_id', 'node');
|
||||
$table->renameColumn('owner_id', 'owner');
|
||||
|
@ -77,6 +72,7 @@ class UpdateColumnNames extends Migration
|
|||
$table->foreign('allocation')->references('id')->on('allocations');
|
||||
$table->foreign('service')->references('id')->on('services');
|
||||
$table->foreign('option')->references('id')->on('service_options');
|
||||
$table->foreign('pack')->references('id')->on('service_packs');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\ServiceOption;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
@ -14,14 +15,8 @@ class DeleteServiceExecutableOption extends Migration
|
|||
public function up()
|
||||
{
|
||||
DB::transaction(function () {
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->renameColumn('file', 'folder');
|
||||
$table->text('description')->nullable()->change();
|
||||
$table->text('startup')->nullable()->change();
|
||||
});
|
||||
|
||||
// Attempt to fix any startup commands for servers
|
||||
// that we possibly can.
|
||||
// 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;
|
||||
|
@ -29,12 +24,27 @@ class DeleteServiceExecutableOption extends Migration
|
|||
$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');
|
||||
$table->text('description')->nullable()->change();
|
||||
$table->text('startup')->nullable()->change();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class AddNewServiceOptionsColumns extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign('config_from');
|
||||
$table->dropForeign(['config_from']);
|
||||
|
||||
$table->dropColumn('config_from');
|
||||
$table->dropColumn('config_stop');
|
||||
|
|
|
@ -49,6 +49,7 @@ class MigrateToNewServiceSystem extends Migration
|
|||
} elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
|
||||
$item->tag = 'source';
|
||||
}
|
||||
$item->save();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class ChangeServiceVariablesValidationRules extends Migration
|
|||
|
||||
DB::transaction(function () {
|
||||
foreach (ServiceVariable::all() as $variable) {
|
||||
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->regex;
|
||||
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->rules;
|
||||
$variable->save();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddForeignKeyToPacks extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->foreign('pack_id')->references('id')->on('packs');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropForeign(['pack_id']);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddServerDescriptionColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->text('description')->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('description');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropDeletedAtColumnFromServers extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('deleted_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
52
database/migrations/2017_04_15_125021_UpgradeTaskSystem.php
Normal file
52
database/migrations/2017_04_15_125021_UpgradeTaskSystem.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use Pterodactyl\Models\Task;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UpgradeTaskSystem extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropForeign(['server']);
|
||||
|
||||
$table->renameColumn('server', 'server_id');
|
||||
$table->unsignedInteger('user_id')->nullable()->after('id');
|
||||
|
||||
$table->foreign('server_id')->references('id')->on('servers');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
|
||||
DB::transaction(function () {
|
||||
foreach(Task::all() as $task) {
|
||||
$task->user_id = $task->server->owner_id;
|
||||
$task->save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropForeign(['server_id']);
|
||||
$table->dropForeign(['user_id']);
|
||||
|
||||
$table->renameColumn('server_id', 'server');
|
||||
$table->dropColumn('user_id');
|
||||
|
||||
$table->foreign('server')->references('id')->on('servers');
|
||||
});
|
||||
}
|
||||
}
|
Reference in a new issue