Fix unability to store '-1' in the database properly
This commit is contained in:
parent
958c29cfbf
commit
ffc8d4875f
3 changed files with 40 additions and 12 deletions
|
@ -10,6 +10,8 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
|||
* `[beta.3]` — Fixes a bug that would cause an error when attempting to create a new user on the Panel.
|
||||
* `[beta.3]` — Fixes error handling of the settings service provider when no migrations have been run.
|
||||
* `[beta.3]` — Fixes validation error when trying to use 'None' as the 'Copy Script From' option for an egg script.
|
||||
* Fixes a design bug in the database that prevented the storage of negative numbers, thus preventing a server from being assigned unlimited swap.
|
||||
|
||||
### Added
|
||||
* Nest and Egg listings now show the associated ID in order to make API requests easier.
|
||||
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Services\Servers;
|
||||
|
||||
|
@ -113,6 +106,7 @@ class BuildModificationService
|
|||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function handle($server, array $data)
|
||||
{
|
||||
|
@ -138,11 +132,11 @@ class BuildModificationService
|
|||
}
|
||||
|
||||
$server = $this->repository->update($server->id, [
|
||||
'memory' => array_get($data, 'memory', $server->memory),
|
||||
'swap' => array_get($data, 'swap', $server->swap),
|
||||
'io' => array_get($data, 'io', $server->io),
|
||||
'cpu' => array_get($data, 'cpu', $server->cpu),
|
||||
'disk' => array_get($data, 'disk', $server->disk),
|
||||
'memory' => (int) array_get($data, 'memory', $server->memory),
|
||||
'swap' => (int) array_get($data, 'swap', $server->swap),
|
||||
'io' => (int) array_get($data, 'io', $server->io),
|
||||
'cpu' => (int) array_get($data, 'cpu', $server->cpu),
|
||||
'disk' => (int) array_get($data, 'disk', $server->disk),
|
||||
'allocation_id' => array_get($data, 'allocation_id', $server->allocation_id),
|
||||
]);
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AllowNegativeValuesForServerSwap extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->integer('swap')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->unsignedInteger('swap')->change();
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue