Skip to content

Commit 873ddd2

Browse files
committed
Hotfix for broken rc.1 installs and upgrades
1 parent a55220d commit 873ddd2

File tree

4 files changed

+40
-31
lines changed

4 files changed

+40
-31
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6-
## v0.5.0-pre.4 (Bodacious Boreopterus)
6+
## v0.5.0-rc.2 (Bodacious Boreopterus)
7+
8+
### Fixed
9+
* Fixes a bug that would cause MySQL errors when attempting to install the panel rather than upgrading.
10+
11+
## v0.5.0-rc.1 (Bodacious Boreopterus)
712

813
### Added
914
* Foreign keys are now enabled on all tables that the panel makes use of to prevent accidental data deletion when associated with other tables.

database/migrations/2016_09_17_194246_add_docker_image_column.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ public function up()
2020
});
2121

2222
// Populate the column
23-
$servers = Server::select(
24-
'servers.id',
25-
'service_options.docker_image as s_optionImage'
26-
)->join('service_options', 'service_options.id', '=', 'servers.option')->get();
23+
DB::transaction(function () {
24+
$servers = DB::table('servers')->select(
25+
'servers.id',
26+
'service_options.docker_image as s_optionImage'
27+
)->join('service_options', 'service_options.id', '=', 'servers.option')->get();
2728

28-
foreach ($servers as $server) {
29-
$server->image = $server->s_optionImage;
30-
$server->save();
31-
}
29+
foreach ($servers as $server) {
30+
$server->image = $server->s_optionImage;
31+
$server->save();
32+
}
33+
});
3234
}
3335

3436
/**

database/migrations/2016_09_29_213518_rename_double_insurgency.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Database\Migrations\Migration;
66

7-
use Pterodactyl\Models\ServiceOptions;
8-
97
class RenameDoubleInsurgency extends Migration
108
{
119
/**
@@ -15,11 +13,13 @@ class RenameDoubleInsurgency extends Migration
1513
*/
1614
public function up()
1715
{
18-
$model = ServiceOptions::where('parent_service', 2)->where('id', 3)->where('name', 'Insurgency')->first();
19-
if ($model) {
20-
$model->name = 'Team Fortress 2';
21-
$model->save();
22-
}
16+
DB::transaction(function () {
17+
$model = DB::table('service_options')->where('parent_service', 2)->where('id', 3)->where('name', 'Insurgency')->first();
18+
if ($model) {
19+
$model->name = 'Team Fortress 2';
20+
$model->save();
21+
}
22+
});
2323
}
2424

2525
/**

database/migrations/2016_10_30_000949_add_ark_service_option.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Database\Migrations\Migration;
66

7-
use Pterodactyl\Models\Service;
8-
use Pterodactyl\Models\ServiceOptions;
9-
use Pterodactyl\Models\ServiceVariables;
10-
117
class AddArkServiceOption extends Migration
128
{
139
/**
@@ -18,12 +14,12 @@ class AddArkServiceOption extends Migration
1814
public function up()
1915
{
2016
DB::transaction(function () {
21-
$service = Service::select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
17+
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
2218
if (!$service) {
2319
exit('No service could be found.');
2420
}
2521

26-
$option = ServiceOptions::create([
22+
$oid = DB::table('service_options')->getInsertId([
2723
'parent_service' => $service->id,
2824
'name' => 'Ark: Survival Evolved',
2925
'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 @@ public function up()
3329
'startup' => 'TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}'
3430
]);
3531

36-
ServiceVariables::create([
37-
'option_id' => $option->id,
32+
DB::table('service_variables')->insert([
33+
'option_id' => $oid,
3834
'name' => 'Server Password',
3935
'description' => 'If specified, players must provide this password to join the server.',
4036
'env_variable' => 'ARK_PASSWORD',
@@ -45,8 +41,8 @@ public function up()
4541
'regex' => '/^(\w\.*)$/'
4642
]);
4743

48-
ServiceVariables::create([
49-
'option_id' => $option->id,
44+
DB::table('service_variables')->insert([
45+
'option_id' => $oid,
5046
'name' => 'Admin Password',
5147
'description' => 'If specified, players must provide this password (via the in-game console) to gain access to administrator commands on the server.',
5248
'env_variable' => 'ARK_ADMIN_PASSWORD',
@@ -57,8 +53,8 @@ public function up()
5753
'regex' => '/^(\w\.*)$/'
5854
]);
5955

60-
ServiceVariables::create([
61-
'option_id' => $option->id,
56+
DB::table('service_variables')->insert([
57+
'option_id' => $oid,
6258
'name' => 'Maximum Players',
6359
'description' => 'Specifies the maximum number of players that can play on the server simultaneously.',
6460
'env_variable' => 'SERVER_MAX_PLAYERS',
@@ -80,9 +76,15 @@ public function up()
8076
public function down()
8177
{
8278
DB::transaction(function () {
83-
$service = Service::select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
84-
$option = ServiceOptions::where('parent_service', $service->id)->where('tag', 'ark')->delete();
85-
$variables = ServiceVariables::where('option_id', $option->id)->delete();
79+
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
80+
81+
if ($service) {
82+
$option = DB::table('service_options')->where('parent_service', $service->id)->where('tag', 'ark')->first();
83+
84+
if ($option) {
85+
$variables = DB::table('service_variables')->where('option_id', $option->id)->delete();
86+
}
87+
}
8688
});
8789
}
8890
}

0 commit comments

Comments
 (0)