1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-10-27 04:12:28 +01:00

Hotfix for broken rc.1 installs and upgrades

This commit is contained in:
Dane Everitt 2016-10-31 17:15:30 -04:00
parent a55220da39
commit 873ddd204d
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
4 changed files with 40 additions and 31 deletions

View File

@ -3,7 +3,12 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.5.0-pre.4 (Bodacious Boreopterus)
## v0.5.0-rc.2 (Bodacious Boreopterus)
### Fixed
* Fixes a bug that would cause MySQL errors when attempting to install the panel rather than upgrading.
## v0.5.0-rc.1 (Bodacious Boreopterus)
### Added
* Foreign keys are now enabled on all tables that the panel makes use of to prevent accidental data deletion when associated with other tables.

View File

@ -20,15 +20,17 @@ class AddDockerImageColumn extends Migration
});
// Populate the column
$servers = Server::select(
'servers.id',
'service_options.docker_image as s_optionImage'
)->join('service_options', 'service_options.id', '=', 'servers.option')->get();
DB::transaction(function () {
$servers = DB::table('servers')->select(
'servers.id',
'service_options.docker_image as s_optionImage'
)->join('service_options', 'service_options.id', '=', 'servers.option')->get();
foreach ($servers as $server) {
$server->image = $server->s_optionImage;
$server->save();
}
foreach ($servers as $server) {
$server->image = $server->s_optionImage;
$server->save();
}
});
}
/**

View File

@ -4,8 +4,6 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Pterodactyl\Models\ServiceOptions;
class RenameDoubleInsurgency extends Migration
{
/**
@ -15,11 +13,13 @@ class RenameDoubleInsurgency extends Migration
*/
public function up()
{
$model = ServiceOptions::where('parent_service', 2)->where('id', 3)->where('name', 'Insurgency')->first();
if ($model) {
$model->name = 'Team Fortress 2';
$model->save();
}
DB::transaction(function () {
$model = DB::table('service_options')->where('parent_service', 2)->where('id', 3)->where('name', 'Insurgency')->first();
if ($model) {
$model->name = 'Team Fortress 2';
$model->save();
}
});
}
/**

View File

@ -4,10 +4,6 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOptions;
use Pterodactyl\Models\ServiceVariables;
class AddArkServiceOption extends Migration
{
/**
@ -18,12 +14,12 @@ class AddArkServiceOption extends Migration
public function up()
{
DB::transaction(function () {
$service = Service::select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
if (!$service) {
exit('No service could be found.');
}
$option = ServiceOptions::create([
$oid = DB::table('service_options')->getInsertId([
'parent_service' => $service->id,
'name' => 'Ark: Survival Evolved',
'description' => 'As a man or woman stranded, naked, freezing, and starving on the unforgiving shores of a mysterious island called ARK, use your skill and cunning to kill or tame and ride the plethora of leviathan dinosaurs and other primeval creatures roaming the land. Hunt, harvest resources, craft items, grow crops, research technologies, and build shelters to withstand the elements and store valuables, all while teaming up with (or preying upon) hundreds of other players to survive, dominate... and escape! — Gamepedia: ARK',
@ -33,8 +29,8 @@ class AddArkServiceOption extends Migration
'startup' => 'TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}'
]);
ServiceVariables::create([
'option_id' => $option->id,
DB::table('service_variables')->insert([
'option_id' => $oid,
'name' => 'Server Password',
'description' => 'If specified, players must provide this password to join the server.',
'env_variable' => 'ARK_PASSWORD',
@ -45,8 +41,8 @@ class AddArkServiceOption extends Migration
'regex' => '/^(\w\.*)$/'
]);
ServiceVariables::create([
'option_id' => $option->id,
DB::table('service_variables')->insert([
'option_id' => $oid,
'name' => 'Admin Password',
'description' => 'If specified, players must provide this password (via the in-game console) to gain access to administrator commands on the server.',
'env_variable' => 'ARK_ADMIN_PASSWORD',
@ -57,8 +53,8 @@ class AddArkServiceOption extends Migration
'regex' => '/^(\w\.*)$/'
]);
ServiceVariables::create([
'option_id' => $option->id,
DB::table('service_variables')->insert([
'option_id' => $oid,
'name' => 'Maximum Players',
'description' => 'Specifies the maximum number of players that can play on the server simultaneously.',
'env_variable' => 'SERVER_MAX_PLAYERS',
@ -80,9 +76,15 @@ class AddArkServiceOption extends Migration
public function down()
{
DB::transaction(function () {
$service = Service::select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
$option = ServiceOptions::where('parent_service', $service->id)->where('tag', 'ark')->delete();
$variables = ServiceVariables::where('option_id', $option->id)->delete();
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
if ($service) {
$option = DB::table('service_options')->where('parent_service', $service->id)->where('tag', 'ark')->first();
if ($option) {
$variables = DB::table('service_variables')->where('option_id', $option->id)->delete();
}
}
});
}
}