Attempt to properly handle new start lines on servers for migration

This commit is contained in:
Dane Everitt 2017-03-12 18:26:36 -04:00
parent 63029bb396
commit d67f65bb71
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 54 additions and 38 deletions

View File

@ -13,12 +13,30 @@ class DeleteServiceExecutableOption extends Migration
*/
public function up()
{
DB::transaction(function () {
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('executable');
$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.
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;
$s->save();
});
}
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('executable');
});
});
}
/**

View File

@ -13,7 +13,6 @@ class AddNewServiceOptionsColumns extends Migration
*/
public function up()
{
DB::transaction(function () {
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('executable');
@ -25,7 +24,6 @@ class AddNewServiceOptionsColumns extends Migration
$table->foreign('config_from')->references('id')->on('service_options');
});
});
}
/**
@ -35,7 +33,6 @@ class AddNewServiceOptionsColumns extends Migration
*/
public function down()
{
DB::transaction(function () {
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('config_from');
@ -47,6 +44,5 @@ class AddNewServiceOptionsColumns extends Migration
$table->string('executable')->after('docker_image')->nullable();
});
});
}
}

View File

@ -34,6 +34,7 @@ class MigrateToNewServiceSystem extends Migration
*/
public function up()
{
DB::transaction(function () {
$service = Service::where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
if (! $service) {
return;
@ -49,6 +50,7 @@ class MigrateToNewServiceSystem extends Migration
$item->tag = 'source';
}
});
});
}
/**