PostgreSQL Support (#4486)

Co-authored-by: Matthew Penner <matthew@pterodactyl.io>
This commit is contained in:
Lance Pioch 2022-11-25 15:29:04 -05:00 committed by GitHub
parent 21613fa602
commit 3bf5a71802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
223 changed files with 912 additions and 1052 deletions

20
.env.ci
View file

@ -1,20 +0,0 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomString3232RandomString
APP_THEME=pterodactyl
APP_TIMEZONE=UTC
APP_URL=http://localhost/
APP_ENVIRONMENT_ONLY=true
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
MAIL_DRIVER=array
QUEUE_DRIVER=sync
HASHIDS_SALT=test123

View file

@ -11,23 +11,43 @@ on:
- "1.0-develop"
jobs:
tests:
name: Tests
mysql:
name: MySQL
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: [8.0, 8.1]
database: ["mariadb:10.2", "mysql:8"]
php: [8.1]
database: ["mariadb:10.2", "mariadb:10.9", "mysql:8"]
services:
database:
image: ${{ matrix.database }}
image: docker.io/library/${{ matrix.database }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testing
ports:
- 3306
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
APP_ENV: testing
APP_DEBUG: "true"
APP_KEY: SomeRandomString3232RandomString
APP_THEME: pterodactyl
APP_TIMEZONE: UTC
APP_URL: http://localhost/
APP_ENVIRONMENT_ONLY: "true"
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_DATABASE: testing
DB_USERNAME: root
CACHE_DRIVER: array
MAIL_MAILER: array
SESSION_DRIVER: array
QUEUE_CONNECTION: sync
HASHIDS_SALT: test123
steps:
- name: Code Checkout
uses: actions/checkout@v3
@ -53,9 +73,6 @@ jobs:
tools: composer:v2
coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
@ -69,4 +86,82 @@ jobs:
run: vendor/bin/phpunit tests/Integration
env:
DB_PORT: ${{ job.services.database.ports[3306] }}
DB_USERNAME: root
postgres:
name: PostgreSQL
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
php: [8.1]
database: ["postgres:13", "postgres:14", "postgres:15"]
services:
database:
image: docker.io/library/${{ matrix.database }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testing
ports:
- 5432/tcp
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
env:
APP_ENV: testing
APP_DEBUG: "true"
APP_KEY: SomeRandomString3232RandomString
APP_THEME: pterodactyl
APP_TIMEZONE: UTC
APP_URL: http://localhost/
APP_ENVIRONMENT_ONLY: "true"
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_DATABASE: testing
DB_USERNAME: postgres
DB_PASSWORD: postgres
CACHE_DRIVER: array
MAIL_MAILER: array
SESSION_DRIVER: array
QUEUE_CONNECTION: sync
HASHIDS_SALT: test123
steps:
- name: Code Checkout
uses: actions/checkout@v3
- name: Get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.php_cs.cache
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-cache-${{ matrix.php }}-${{ hashFiles('**.composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip
tools: composer:v2
coverage: none
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
- name: Unit tests
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit
if: ${{ always() }}
env:
DB_HOST: UNIT_NO_DB
- name: Integration tests
run: vendor/bin/phpunit tests/Integration
env:
DB_PORT: ${{ job.services.database.ports[5432] }}

View file

@ -26,9 +26,6 @@ jobs:
tools: composer:v2
coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist

View file

@ -40,6 +40,11 @@ class ClientController extends ClientApiController
AllowedFilter::custom('*', new MultiFieldServerFilter()),
]);
$loweredBindings = collect($builder->getBindings())
->map(fn ($f, $key) => is_string($f) ? strtolower($f) : $f)
->all();
$builder->setBindings($loweredBindings);
$type = $request->input('type');
// Either return all the servers the user has access to because they are an admin `?type=admin` or
// just return all the servers the user has access to because they are the owner or a subuser of the

View file

@ -225,8 +225,8 @@ class Node extends Model
*/
public function isViable(int $memory, int $disk): bool
{
$memoryLimit = $this->memory * (1 + ($this->memory_overallocate / 100));
$diskLimit = $this->disk * (1 + ($this->disk_overallocate / 100));
$memoryLimit = $this->memory * (1.0 + ($this->memory_overallocate / 100.0));
$diskLimit = $this->disk * (1.0 + ($this->disk_overallocate / 100.0));
return ($this->sum_memory + $memory) <= $memoryLimit && ($this->sum_disk + $disk) <= $diskLimit;
}

View file

@ -76,7 +76,9 @@ use Pterodactyl\Notifications\SendPasswordReset as ResetPasswordNotification;
* @method static Builder|User whereUsername($value)
* @method static Builder|User whereUuid($value)
*
* @mixin \Eloquent
* @mixin \Barryvdh\LaravelIdeHelper\Eloquent
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Builder
*/
class User extends Model implements
AuthenticatableContract,

View file

@ -2,12 +2,12 @@
namespace Pterodactyl\Providers;
use View;
use Cache;
use Pterodactyl\Models;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\URL;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Extensions\Themes\Theme;

View file

@ -14,13 +14,10 @@ class HashidsServiceProvider extends ServiceProvider
public function register()
{
$this->app->singleton(HashidsInterface::class, function () {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $this->app['config'];
return new Hashids(
$config->get('hashids.salt', ''),
$config->get('hashids.length', 0),
$config->get('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
config('hashids.salt', ''),
config('hashids.length', 0),
config('hashids.alphabet', 'abcdefghijkmlnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
);
});

View file

@ -41,7 +41,7 @@ use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class RepositoryServiceProvider extends ServiceProvider
{
/**
* Register all of the repository bindings.
* Register all the repository bindings.
*/
public function register()
{

View file

@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider
});
// This is needed to make use of the "resolveRouteBinding" functionality in the
// model. Without it you'll never trigger that logic flow thus resulting in a 404
// model. Without it, you'll never trigger that logic flow thus resulting in a 404
// error because we request databases with a HashID, and not with a normal ID.
Route::model('database', Database::class);

View file

@ -80,7 +80,7 @@ class SettingsServiceProvider extends ServiceProvider
if (in_array($key, self::$encrypted)) {
try {
$value = $encrypter->decrypt($value);
} catch (DecryptException $exception) {
} catch (DecryptException) {
}
}

View file

@ -40,14 +40,14 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos
*/
protected function getDiscardableDedicatedAllocations(array $nodes = []): array
{
$query = Allocation::query()->selectRaw('CONCAT_WS("-", node_id, ip) as result');
$query = Allocation::query()->selectRaw('CONCAT_WS(\'-\', node_id, ip) as result');
if (!empty($nodes)) {
$query->whereIn('node_id', $nodes);
}
return $query->whereNotNull('server_id')
->groupByRaw('CONCAT(node_id, ip)')
->groupByRaw('result')
->get()
->pluck('result')
->toArray();
@ -89,7 +89,7 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos
if (!empty($discard)) {
$query->whereNotIn(
$this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'),
$this->getBuilder()->raw('CONCAT_WS(\'-\', node_id, ip)'),
$discard
);
}

View file

@ -2,9 +2,12 @@
namespace Pterodactyl\Repositories\Eloquent;
use PDO;
use RuntimeException;
use Illuminate\Http\Request;
use Webmozart\Assert\Assert;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Repositories\Repository;
use Illuminate\Database\Eloquent\Builder;
@ -271,7 +274,17 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf
return sprintf('(%s)', $grammar->parameterize($record));
})->implode(', ');
$statement = "insert ignore into $table ($columns) values $parameters";
$driver = DB::getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
switch ($driver) {
case 'mysql':
$statement = "insert ignore into $table ($columns) values $parameters";
break;
case 'pgsql':
$statement = "insert into $table ($columns) values $parameters on conflict do nothing";
break;
default:
throw new RuntimeException("Unsupported database driver \"$driver\" for insert ignore.");
}
return $this->getBuilder()->getConnection()->statement($statement, $bindings);
}

View file

@ -22,7 +22,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
public function getUsageStats(Node $node): array
{
$stats = $this->getBuilder()
->selectRaw('IFNULL(SUM(servers.memory), 0) as sum_memory, IFNULL(SUM(servers.disk), 0) as sum_disk')
->selectRaw('COALESCE(SUM(servers.memory), 0) as sum_memory, COALESCE(SUM(servers.disk), 0) as sum_disk')
->join('servers', 'servers.node_id', '=', 'nodes.id')
->where('node_id', '=', $node->id)
->first();
@ -54,7 +54,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
public function getUsageStatsRaw(Node $node): array
{
$stats = $this->getBuilder()->select(
$this->getBuilder()->raw('IFNULL(SUM(servers.memory), 0) as sum_memory, IFNULL(SUM(servers.disk), 0) as sum_disk')
$this->getBuilder()->raw('COALESCE(SUM(servers.memory), 0) as sum_memory, COALESCE(SUM(servers.disk), 0) as sum_disk')
)->join('servers', 'servers.node_id', '=', 'nodes.id')->where('node_id', $node->id)->first();
return collect(['disk' => $stats->sum_disk, 'memory' => $stats->sum_memory])->mapWithKeys(function ($value, $key) use ($node) {
@ -143,7 +143,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
{
$instance = $this->getBuilder()
->select(['nodes.id', 'nodes.fqdn', 'nodes.scheme', 'nodes.daemon_token', 'nodes.daemonListen', 'nodes.memory', 'nodes.disk', 'nodes.memory_overallocate', 'nodes.disk_overallocate'])
->selectRaw('IFNULL(SUM(servers.memory), 0) as sum_memory, IFNULL(SUM(servers.disk), 0) as sum_disk')
->selectRaw('COALESCE(SUM(servers.memory), 0) as sum_memory, COALESCE(SUM(servers.disk), 0) as sum_disk')
->leftJoin('servers', 'servers.node_id', '=', 'nodes.id')
->where('nodes.id', $node_id);

View file

@ -72,8 +72,8 @@ class FindViableNodesService
Assert::integer($this->memory, 'Memory usage must be an int, got %s');
$query = Node::query()->select('nodes.*')
->selectRaw('IFNULL(SUM(servers.memory), 0) as sum_memory')
->selectRaw('IFNULL(SUM(servers.disk), 0) as sum_disk')
->selectRaw('COALESCE(SUM(servers.memory), 0) as sum_memory')
->selectRaw('COALESCE(SUM(servers.disk), 0) as sum_disk')
->leftJoin('servers', 'servers.node_id', '=', 'nodes.id')
->where('nodes.public', 1);
@ -82,8 +82,8 @@ class FindViableNodesService
}
$results = $query->groupBy('nodes.id')
->havingRaw('(IFNULL(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1 + (nodes.memory_overallocate / 100)))', [$this->memory])
->havingRaw('(IFNULL(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1 + (nodes.disk_overallocate / 100)))', [$this->disk]);
->havingRaw('(COALESCE(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1.0 + (nodes.memory_overallocate / 100.0)))', [$this->memory])
->havingRaw('(COALESCE(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1.0 + (nodes.disk_overallocate / 100.0)))', [$this->disk]);
if (!is_null($page)) {
$results = $results->paginate($perPage ?? 50, ['*'], 'page', $page);

View file

@ -40,6 +40,8 @@ if (!env('SKIP_MIGRATIONS')) {
$output->writeln('<info>Seeding database for Integration tests...</info>' . PHP_EOL);
$kernel->call('db:seed');
$output->writeln('<info>Database configured, running Integration tests...</info>' . PHP_EOL);
} else {
$output->writeln(PHP_EOL . '<comment>Skipping database migrations...</comment>' . PHP_EOL);
}

View file

@ -57,6 +57,21 @@ return [
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'panel'),
'username' => env('DB_USERNAME', 'pterodactyl'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
],
/*

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddAllocationsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('allocations', function (Blueprint $table) {
$table->increments('id');
@ -23,7 +24,7 @@ class AddAllocationsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('allocations');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddApiKeys extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('api_keys', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class AddApiKeys extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('api_keys');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddApiPermissions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('api_permissions', function (Blueprint $table) {
$table->increments('id');
@ -20,7 +21,7 @@ class AddApiPermissions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('api_permissions');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddDownloads extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('downloads', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class AddDownloads extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('downloads');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class CreateFailedJobsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class CreateFailedJobsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class CreateJobsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
@ -19,6 +20,7 @@ class CreateJobsTable extends Migration
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
$table->index(['queue', 'reserved', 'reserved_at']);
});
}
@ -26,7 +28,7 @@ class CreateJobsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('jobs');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddLocations extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('locations', function (Blueprint $table) {
$table->increments('id');
@ -21,7 +22,7 @@ class AddLocations extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('locations');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddNodes extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('nodes', function (Blueprint $table) {
$table->increments('id');
@ -23,7 +24,7 @@ class AddNodes extends Migration
$table->mediumInteger('disk_overallocate')->unsigned()->nullable();
$table->char('daemonSecret', 36)->unique();
$table->smallInteger('daemonListen')->unsigned()->default(8080);
$table->smallInteger('daemonSFTP')->unsgined()->default(2022);
$table->smallInteger('daemonSFTP')->unsigned()->default(2022);
$table->string('daemonBase')->default('/home/daemon-files');
$table->timestamps();
});
@ -32,7 +33,7 @@ class AddNodes extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('nodes');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddPasswordResets extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
@ -20,7 +21,7 @@ class AddPasswordResets extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('password_resets');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddPermissions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class AddPermissions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('permissions');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServerVariables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('server_variables', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class AddServerVariables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('server_variables');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('servers', function (Blueprint $table) {
$table->increments('id');
@ -39,7 +40,7 @@ class AddServers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('servers');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServiceOptions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('service_options', function (Blueprint $table) {
$table->increments('id');
@ -24,7 +25,7 @@ class AddServiceOptions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('service_options');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServiceVaribles extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('service_variables', function (Blueprint $table) {
$table->increments('id');
@ -28,7 +29,7 @@ class AddServiceVaribles extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('service_variables');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServices extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('services', function (Blueprint $table) {
$table->increments('id');
@ -24,7 +25,7 @@ class AddServices extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('services');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class CreateSettingsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->string('key')->unique();
@ -19,7 +20,7 @@ class CreateSettingsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('settings');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddSubusers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('subusers', function (Blueprint $table) {
$table->increments('id');
@ -22,7 +23,7 @@ class AddSubusers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('subusers');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddUsers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
@ -27,7 +28,7 @@ class AddUsers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('users');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class CreateSessionsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
@ -23,7 +24,7 @@ class CreateSessionsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('sessions');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class RenamePermissionsColumn extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('permissions', function (Blueprint $table) {
$table->renameColumn('permissions', 'permission');
@ -18,7 +19,7 @@ class RenamePermissionsColumn extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('permissions', function (Blueprint $table) {
});

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddDatabasesTables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('databases', function (Blueprint $table) {
$table->increments('id');
@ -25,7 +26,7 @@ class AddDatabasesTables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('databases');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddDatabaseServersTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('database_servers', function (Blueprint $table) {
$table->increments('id');
@ -26,7 +27,7 @@ class AddDatabaseServersTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('database_servers');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddServiceOptionDefaultStartup extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->text('executable')->after('docker_image')->nullable()->default(null);
@ -19,7 +20,7 @@ class AddServiceOptionDefaultStartup extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('executable');

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddUniqueServiceField extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->string('file')->unique()->change();
@ -18,10 +19,10 @@ class AddUniqueServiceField extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->dropUnique('services_file_unique');
$table->dropUnique(['file']);
});
}
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddTasksTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('tasks', function (Blueprint $table) {
$table->increments('id');
@ -32,7 +33,7 @@ class AddTasksTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('tasks');
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddTasksLogTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('tasks_log', function (Blueprint $table) {
$table->increments('id');
@ -23,7 +24,7 @@ class AddTasksLogTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('tasks_log');
}

View file

@ -1,24 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddNullableFieldLastrun extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
$table = DB::getQueryGrammar()->wrapTable('tasks');
DB::statement('ALTER TABLE ' . $table . ' CHANGE `last_run` `last_run` TIMESTAMP NULL;');
}
/**
* Reverse the migrations.
*/
public function down()
{
$table = DB::getQueryGrammar()->wrapTable('tasks');
DB::statement('ALTER TABLE ' . $table . ' CHANGE `last_run` `last_run` TIMESTAMP;');
}
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddIpAlias extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->text('ip_alias')->nullable()->after('ip');
@ -29,7 +30,7 @@ class AddIpAlias extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropColumn('ip_alias');

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class ModifyIpStorageMethod extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->mediumInteger('allocation')->unsigned()->after('oom_disabled');
@ -47,7 +48,7 @@ class ModifyIpStorageMethod extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->text('ip')->after('allocation');

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddSuspensionForServers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->tinyInteger('suspended')->unsigned()->default(0)->after('active');
@ -18,7 +19,7 @@ class AddSuspensionForServers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('suspended');

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class RemoveActiveColumn extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('active');
@ -18,7 +19,7 @@ class RemoveActiveColumn extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->tinyInteger('active')->after('name')->unsigned()->default(0);

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddSftpPasswordStorage extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->text('sftp_password')->after('username')->nullable();
@ -18,7 +19,7 @@ class AddSftpPasswordStorage extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('sftp_password');

View file

@ -9,11 +9,12 @@ class UpdateJobsTables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('jobs', function (Blueprint $table) {
$table->dropIndex('jobs_queue_reserved_reserved_at_index');
$table->dropIndex(['queue', 'reserved', 'reserved_at']);
$table->dropColumn('reserved');
$table->index(['queue', 'reserved_at']);
});
}
@ -21,10 +22,11 @@ class UpdateJobsTables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('jobs', function (Blueprint $table) {
$table->dropIndex('jobs_queue_reserved_at_index');
$table->dropIndex(['queue', 'reserved_at']);
$table->tinyInteger('reserved')->unsigned();
$table->index(['queue', 'reserved', 'reserved_at']);
});

View file

@ -9,7 +9,7 @@ class UpdateFailedJobsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->text('exception');
@ -19,7 +19,7 @@ class UpdateFailedJobsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('failed_jobs', function (Blueprint $table) {
$table->dropColumn('exception');

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class CreateNotificationsTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->string('id')->primary();
@ -23,7 +24,7 @@ class CreateNotificationsTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('notifications');
}

View file

@ -9,7 +9,7 @@ class AddUniqueIdentifier extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->char('author', 36)->after('id');
@ -19,7 +19,7 @@ class AddUniqueIdentifier extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('author');

View file

@ -9,7 +9,7 @@ class AllowLongerRegexField extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_variables', function (Blueprint $table) {
$table->text('regex')->change();
@ -19,7 +19,7 @@ class AllowLongerRegexField extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_variables', function (Blueprint $table) {
$table->string('regex')->change();

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -9,7 +10,7 @@ class AddDockerImageColumn extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->string('image')->after('daemonSecret');
@ -32,7 +33,7 @@ class AddDockerImageColumn extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('image');

View file

@ -9,7 +9,7 @@ class UpdateServersColumnName extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->renameColumn('server', 'server_id');
@ -19,7 +19,7 @@ class UpdateServersColumnName extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->renameColumn('server_id', 'server');

View file

@ -7,7 +7,7 @@ class RenameDoubleInsurgency extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::transaction(function () {
$model = DB::table('service_options')->where('parent_service', 2)->where('id', 3)->where('name', 'Insurgency')->first();
@ -21,7 +21,7 @@ class RenameDoubleInsurgency extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
}
}

View file

@ -9,7 +9,7 @@ class BuildApiLogTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('api_logs', function (Blueprint $table) {
$table->increments('id');
@ -28,7 +28,7 @@ class BuildApiLogTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('api_logs');
}

View file

@ -9,7 +9,7 @@ class UpdateApiKeys extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->unsignedInteger('user')->after('id');
@ -21,7 +21,7 @@ class UpdateApiKeys extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropColumn('user');

View file

@ -7,7 +7,7 @@ class UpdateMisnamedBungee extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::table('service_variables')->select('env_variable')->where('env_variable', 'BUNGE_VERSION')->update([
'env_variable' => 'BUNGEE_VERSION',
@ -17,7 +17,7 @@ class UpdateMisnamedBungee extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
}
}

View file

@ -9,22 +9,21 @@ class AddForeignKeysServers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE servers
MODIFY COLUMN node INT(10) UNSIGNED NOT NULL,
MODIFY COLUMN owner INT(10) UNSIGNED NOT NULL,
MODIFY COLUMN allocation INT(10) UNSIGNED NOT NULL,
MODIFY COLUMN service INT(10) UNSIGNED NOT NULL,
MODIFY COLUMN `option` INT(10) UNSIGNED NOT NULL
');
Schema::table('servers', function (Blueprint $table) {
$table->integer('node', false, true)->change();
$table->integer('owner', false, true)->change();
$table->integer('allocation', false, true)->change();
$table->integer('service', false, true)->change();
$table->integer('option', false, true)->change();
$table->foreign('node')->references('id')->on('nodes');
$table->foreign('owner')->references('id')->on('users');
$table->foreign('allocation')->references('id')->on('allocations');
$table->foreign('service')->references('id')->on('services');
$table->foreign('option')->references('id')->on('service_options');
$table->softDeletes();
});
}
@ -32,30 +31,31 @@ class AddForeignKeysServers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign('servers_node_foreign');
$table->dropForeign('servers_owner_foreign');
$table->dropForeign('servers_allocation_foreign');
$table->dropForeign('servers_service_foreign');
$table->dropForeign('servers_option_foreign');
$table->dropForeign(['node']);
$table->dropIndex(['node']);
$table->dropIndex('servers_node_foreign');
$table->dropIndex('servers_owner_foreign');
$table->dropIndex('servers_allocation_foreign');
$table->dropIndex('servers_service_foreign');
$table->dropIndex('servers_option_foreign');
$table->dropForeign(['owner']);
$table->dropIndex(['owner']);
$table->dropForeign(['allocation']);
$table->dropIndex(['allocation']);
$table->dropForeign(['service']);
$table->dropIndex(['service']);
$table->dropForeign(['option']);
$table->dropIndex(['option']);
$table->dropColumn('deleted_at');
});
DB::statement('ALTER TABLE servers
MODIFY COLUMN node MEDIUMINT(8) UNSIGNED NOT NULL,
MODIFY COLUMN owner MEDIUMINT(8) UNSIGNED NOT NULL,
MODIFY COLUMN allocation MEDIUMINT(8) UNSIGNED NOT NULL,
MODIFY COLUMN service MEDIUMINT(8) UNSIGNED NOT NULL,
MODIFY COLUMN `option` MEDIUMINT(8) UNSIGNED NOT NULL
');
$table->mediumInteger('node', false, true)->change();
$table->mediumInteger('owner', false, true)->change();
$table->mediumInteger('allocation', false, true)->change();
$table->mediumInteger('service', false, true)->change();
$table->mediumInteger('option', false, true)->change();
});
}
}

View file

@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -9,14 +10,11 @@ class AddForeignAllocations extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE allocations
MODIFY COLUMN assigned_to INT(10) UNSIGNED NULL,
MODIFY COLUMN node INT(10) UNSIGNED NOT NULL
');
Schema::table('allocations', function (Blueprint $table) {
$table->integer('assigned_to', false, true)->nullable()->change();
$table->integer('node', false, true)->nullable(false)->change();
$table->foreign('assigned_to')->references('id')->on('servers');
$table->foreign('node')->references('id')->on('nodes');
});
@ -25,14 +23,17 @@ class AddForeignAllocations extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign('allocations_assigned_to_foreign');
$table->dropForeign('allocations_node_foreign');
$table->dropForeign(['assigned_to']);
$table->dropIndex(['assigned_to']);
$table->dropIndex('allocations_assigned_to_foreign');
$table->dropIndex('allocations_node_foreign');
$table->dropForeign(['node']);
$table->dropIndex(['node']);
$table->mediumInteger('assigned_to', false, true)->nullable()->change();
$table->mediumInteger('node', false, true)->nullable(false)->change();
});
DB::statement('ALTER TABLE allocations

View file

@ -9,7 +9,7 @@ class AddForeignApiKeys extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->foreign('user')->references('id')->on('users');
@ -19,11 +19,11 @@ class AddForeignApiKeys extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropForeign('api_keys_user_foreign');
$table->dropIndex('api_keys_user_foreign');
$table->dropForeign(['user']);
$table->dropIndex(['user']);
});
}
}

View file

@ -9,11 +9,10 @@ class AddForeignApiPermissions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE api_permissions MODIFY key_id INT(10) UNSIGNED NOT NULL');
Schema::table('api_permissions', function (Blueprint $table) {
$table->integer('key_id', false, true)->nullable(false)->change();
$table->foreign('key_id')->references('id')->on('api_keys');
});
}
@ -21,13 +20,13 @@ class AddForeignApiPermissions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('api_permissions', function (Blueprint $table) {
$table->dropForeign('api_permissions_key_id_foreign');
$table->dropIndex('api_permissions_key_id_foreign');
});
$table->dropForeign(['key_id']);
$table->dropIndex(['key_id']);
DB::statement('ALTER TABLE api_permissions MODIFY key_id MEDIUMINT(8) UNSIGNED NOT NULL');
$table->mediumInteger('key_id', false, true)->nullable(false)->change();
});
}
}

View file

@ -9,7 +9,7 @@ class AddForeignDatabaseServers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('database_servers', function (Blueprint $table) {
$table->foreign('linked_node')->references('id')->on('nodes');
@ -19,11 +19,11 @@ class AddForeignDatabaseServers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign('database_servers_linked_node_foreign');
$table->dropIndex('database_servers_linked_node_foreign');
$table->dropForeign(['linked_node']);
$table->dropIndex(['linked_node']);
});
}
}

View file

@ -9,7 +9,7 @@ class AddForeignDatabases extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->foreign('server_id')->references('id')->on('servers');
@ -20,14 +20,14 @@ class AddForeignDatabases extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->dropForeign('databases_server_id_foreign');
$table->dropForeign('databases_db_server_foreign');
$table->dropForeign(['server_id']);
$table->dropIndex(['server_id']);
$table->dropIndex('databases_server_id_foreign');
$table->dropIndex('databases_db_server_foreign');
$table->dropForeign(['db_server']);
$table->dropIndex(['db_server']);
});
}
}

View file

@ -9,11 +9,10 @@ class AddForeignNodes extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE nodes MODIFY location INT(10) UNSIGNED NOT NULL');
Schema::table('nodes', function (Blueprint $table) {
$table->integer('location', false, true)->nullable(false)->change();
$table->foreign('location')->references('id')->on('locations');
});
}
@ -21,13 +20,13 @@ class AddForeignNodes extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign('nodes_location_foreign');
$table->dropIndex('nodes_location_foreign');
});
$table->dropForeign(['location']);
$table->dropIndex(['location']);
DB::statement('ALTER TABLE nodes MODIFY location MEDIUMINT(10) UNSIGNED NOT NULL');
$table->mediumInteger('location', false, true)->nullable(false)->change();
});
}
}

View file

@ -9,7 +9,7 @@ class AddForeignPermissions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('permissions', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users');
@ -20,14 +20,14 @@ class AddForeignPermissions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign('permissions_user_id_foreign');
$table->dropForeign('permissions_server_id_foreign');
$table->dropForeign(['user_id']);
$table->dropIndex(['user_id']);
$table->dropIndex('permissions_user_id_foreign');
$table->dropIndex('permissions_server_id_foreign');
$table->dropForeign(['server_id']);
$table->dropIndex(['server_id']);
});
}
}

View file

@ -9,14 +9,11 @@ class AddForeignServerVariables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE server_variables
MODIFY COLUMN server_id INT(10) UNSIGNED NULL,
MODIFY COLUMN variable_id INT(10) UNSIGNED NOT NULL
');
Schema::table('server_variables', function (Blueprint $table) {
$table->integer('server_id', false, true)->nullable()->change();
$table->integer('variable_id', false, true)->nullable(false)->change();
$table->foreign('server_id')->references('id')->on('servers');
$table->foreign('variable_id')->references('id')->on('service_variables');
});
@ -25,16 +22,13 @@ class AddForeignServerVariables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('server_variables', function (Blueprint $table) {
$table->dropForeign(['server_id']);
$table->dropForeign(['variable_id']);
$table->mediumInteger('server_id', false, true)->nullable()->change();
$table->mediumInteger('variable_id', false, true)->nullable(false)->change();
});
DB::statement('ALTER TABLE server_variables
MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL,
MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL
');
}
}

View file

@ -9,11 +9,10 @@ class AddForeignServiceOptions extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE service_options MODIFY parent_service INT(10) UNSIGNED NOT NULL');
Schema::table('service_options', function (Blueprint $table) {
$table->integer('parent_service', false, true)->change();
$table->foreign('parent_service')->references('id')->on('services');
});
}
@ -21,13 +20,13 @@ class AddForeignServiceOptions extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('service_options_parent_service_foreign');
$table->dropIndex('service_options_parent_service_foreign');
});
$table->dropForeign(['parent_service']);
$table->dropIndex(['parent_service']);
DB::statement('ALTER TABLE service_options MODIFY parent_service MEDIUMINT(8) UNSIGNED NOT NULL');
$table->mediumInteger('parent_service', false, true)->change();
});
}
}

View file

@ -9,11 +9,10 @@ class AddForeignServiceVariables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::statement('ALTER TABLE service_variables MODIFY option_id INT(10) UNSIGNED NOT NULL');
Schema::table('service_variables', function (Blueprint $table) {
$table->integer('option_id', false, true)->change();
$table->foreign('option_id')->references('id')->on('service_options');
});
}
@ -21,13 +20,13 @@ class AddForeignServiceVariables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_variables', function (Blueprint $table) {
$table->dropForeign('service_variables_option_id_foreign');
$table->dropIndex('service_variables_option_id_foreign');
});
$table->dropForeign(['option_id']);
$table->dropIndex(['option_id']);
DB::statement('ALTER TABLE service_variables MODIFY option_id MEDIUMINT(8) UNSIGNED NOT NULL');
$table->mediumInteger('option_id', false, true)->change();
});
}
}

View file

@ -9,7 +9,7 @@ class AddForeignSubusers extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('subusers', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users');
@ -20,14 +20,14 @@ class AddForeignSubusers extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('subusers', function (Blueprint $table) {
$table->dropForeign('subusers_user_id_foreign');
$table->dropForeign('subusers_server_id_foreign');
$table->dropForeign(['user_id']);
$table->dropIndex(['user_id']);
$table->dropIndex('subusers_user_id_foreign');
$table->dropIndex('subusers_server_id_foreign');
$table->dropForeign(['server_id']);
$table->dropIndex(['server_id']);
});
}
}

View file

@ -9,7 +9,7 @@ class AddForeignTasks extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->foreign('server')->references('id')->on('servers');
@ -19,7 +19,7 @@ class AddForeignTasks extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropForeign(['server']);

View file

@ -7,7 +7,7 @@ class AddArkServiceOptionFixed extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::transaction(function () {
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();
@ -73,7 +73,7 @@ class AddArkServiceOptionFixed extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
DB::transaction(function () {
$service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first();

View file

@ -9,7 +9,7 @@ class AddPackSupport extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('service_packs', function (Blueprint $table) {
$table->increments('id');
@ -29,7 +29,7 @@ class AddPackSupport extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::drop('service_packs');
}

View file

@ -9,7 +9,7 @@ class SetServiceNameUnique extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->unique('name');
@ -19,7 +19,7 @@ class SetServiceNameUnique extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->dropUnique('services_name_unique');

View file

@ -9,7 +9,7 @@ class AddPackColumn extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->unsignedInteger('pack')->nullable()->after('option');
@ -21,7 +21,7 @@ class AddPackColumn extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['pack']);

View file

@ -9,7 +9,7 @@ class AddConfigurableUploadLimit extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->unsignedInteger('upload_size')->after('disk_overallocate')->default(100);
@ -19,7 +19,7 @@ class AddConfigurableUploadLimit extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('upload_size');

View file

@ -7,7 +7,7 @@ class CorrectServiceVariables extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::transaction(function () {
// Modify Default Spigot Startup Line
@ -66,7 +66,7 @@ class CorrectServiceVariables extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
// do nothing
}

View file

@ -7,7 +7,7 @@ class FixMisnamedOptionTag extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::transaction(function () {
DB::table('service_options')->where([
@ -23,7 +23,7 @@ class FixMisnamedOptionTag extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
DB::table('service_options')->where([
['name', 'Sponge (SpongeVanilla)'],

View file

@ -9,7 +9,7 @@ class CreateNodeConfigurationTokensTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::create('node_configuration_tokens', function (Blueprint $table) {
$table->increments('id');
@ -24,7 +24,7 @@ class CreateNodeConfigurationTokensTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::dropIfExists('node_configuration_tokens');
}

View file

@ -10,7 +10,7 @@ class AddMoreUserData extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('name_first')->after('email')->nullable();
@ -34,7 +34,7 @@ class AddMoreUserData extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name_first');

View file

@ -9,22 +9,15 @@ class UpdateColumnNames extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign('servers_node_foreign');
$table->dropForeign('servers_owner_foreign');
$table->dropForeign('servers_allocation_foreign');
$table->dropForeign('servers_service_foreign');
$table->dropForeign('servers_option_foreign');
$table->dropForeign('servers_pack_foreign');
$table->dropIndex('servers_node_foreign');
$table->dropIndex('servers_owner_foreign');
$table->dropIndex('servers_allocation_foreign');
$table->dropIndex('servers_service_foreign');
$table->dropIndex('servers_option_foreign');
$table->dropIndex('servers_pack_foreign');
$table->dropForeign(['node']);
$table->dropForeign(['owner']);
$table->dropForeign(['allocation']);
$table->dropForeign(['service']);
$table->dropForeign(['option']);
$table->dropForeign(['pack']);
$table->renameColumn('node', 'node_id');
$table->renameColumn('owner', 'owner_id');
@ -47,14 +40,10 @@ class UpdateColumnNames extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->dropForeign(['owner_id']);
$table->dropForeign(['allocation_id']);
$table->dropForeign(['service_id']);
$table->dropForeign(['option_id']);
$table->dropForeign(['node_id', 'owner_id', 'allocation_id', 'service_id', 'option_id']);
$table->renameColumn('node_id', 'node');
$table->renameColumn('owner_id', 'owner');

View file

@ -9,11 +9,10 @@ class UpdateNodesTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign('nodes_location_foreign');
$table->dropIndex('nodes_location_foreign');
$table->dropForeign(['location']);
$table->renameColumn('location', 'location_id');
$table->foreign('location_id')->references('id')->on('locations');
@ -23,11 +22,10 @@ class UpdateNodesTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign('nodes_location_id_foreign');
$table->dropIndex('nodes_location_id_foreign');
$table->dropForeign(['location_id']);
$table->renameColumn('location_id', 'location');
$table->foreign('location')->references('id')->on('locations');

View file

@ -9,13 +9,11 @@ class RenameColumns extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign('allocations_node_foreign');
$table->dropForeign('allocations_assigned_to_foreign');
$table->dropIndex('allocations_node_foreign');
$table->dropIndex('allocations_assigned_to_foreign');
$table->dropForeign(['node']);
$table->dropForeign(['assigned_to']);
$table->renameColumn('node', 'node_id');
$table->renameColumn('assigned_to', 'server_id');
@ -27,13 +25,13 @@ class RenameColumns extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('allocations', function (Blueprint $table) {
$table->dropForeign('allocations_node_id_foreign');
$table->dropForeign('allocations_server_id_foreign');
$table->dropIndex('allocations_node_id_foreign');
$table->dropIndex('allocations_server_id_foreign');
$table->dropForeign(['node_id']);
$table->dropForeign(['server_id']);
$table->dropIndex(['node_id']);
$table->dropIndex(['server_id']);
$table->renameColumn('node_id', 'node');
$table->renameColumn('server_id', 'assigned_to');

View file

@ -9,11 +9,10 @@ class AdjustColumnNames extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('service_options_parent_service_foreign');
$table->dropIndex('service_options_parent_service_foreign');
$table->dropForeign(['parent_service']);
$table->renameColumn('parent_service', 'service_id');
$table->foreign('service_id')->references('id')->on('services');
@ -23,11 +22,11 @@ class AdjustColumnNames extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('service_options_service_id_foreign');
$table->dropIndex('service_options_service_id_foreign');
$table->dropForeign(['service_id']);
$table->dropIndex(['service_id']);
$table->renameColumn('service_id', 'parent_service');
$table->foreign('parent_service')->references('id')->on('services');

View file

@ -9,11 +9,10 @@ class AdjustColumnNamesForServicePacks extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign('service_packs_option_foreign');
$table->dropIndex('service_packs_option_foreign');
$table->dropForeign(['option']);
$table->renameColumn('option', 'option_id');
$table->foreign('option_id')->references('id')->on('service_options');
@ -23,11 +22,11 @@ class AdjustColumnNamesForServicePacks extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign('service_packs_option_id_foreign');
$table->dropIndex('service_packs_option_id_foreign');
$table->dropForeign(['option_id']);
$table->dropIndex(['option_id']);
$table->renameColumn('option_id', 'option');
$table->foreign('option')->references('id')->on('service_options');

View file

@ -11,7 +11,7 @@ class SetupPermissionsPivotTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('permissions', function (Blueprint $table) {
$table->unsignedInteger('subuser_id')->after('id');
@ -19,17 +19,15 @@ class SetupPermissionsPivotTable extends Migration
DB::transaction(function () {
foreach (Subuser::all() as &$subuser) {
Permission::where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->update([
Permission::query()->where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->update([
'subuser_id' => $subuser->id,
]);
}
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign('permissions_server_id_foreign');
$table->dropIndex('permissions_server_id_foreign');
$table->dropForeign('permissions_user_id_foreign');
$table->dropIndex('permissions_user_id_foreign');
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
$table->dropColumn('server_id');
$table->dropColumn('user_id');
@ -42,7 +40,7 @@ class SetupPermissionsPivotTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('permissions', function (Blueprint $table) {
$table->unsignedInteger('server_id')->after('subuser_id');
@ -52,7 +50,7 @@ class SetupPermissionsPivotTable extends Migration
DB::transaction(function () {
foreach (Subuser::all() as &$subuser) {
Permission::where('subuser_id', $subuser->id)->update([
Permission::query()->where('subuser_id', $subuser->id)->update([
'user_id' => $subuser->user_id,
'server_id' => $subuser->server_id,
]);
@ -60,8 +58,8 @@ class SetupPermissionsPivotTable extends Migration
});
Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign('permissions_subuser_id_foreign');
$table->dropIndex('permissions_subuser_id_foreign');
$table->dropForeign(['subuser_id']);
$table->dropIndex(['subuser_id']);
$table->dropColumn('subuser_id');
$table->foreign('server_id')->references('id')->on('servers');

View file

@ -9,10 +9,10 @@ class UpdateAPIKeyColumnNames extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropForeign('api_keys_user_foreign')->dropIndex('api_keys_user_foreign');
$table->dropForeign(['user']);
$table->renameColumn('user', 'user_id');
$table->foreign('user_id')->references('id')->on('users');
@ -22,10 +22,10 @@ class UpdateAPIKeyColumnNames extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropForeign('api_keys_user_id_foreign')->dropIndex('api_keys_user_id_foreign');
$table->dropForeign(['user_id']);
$table->renameColumn('user_id', 'user');
$table->foreign('user')->references('id')->on('users');

View file

@ -9,7 +9,7 @@ class UpdateNodeConfigTokensColumns extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('node_configuration_tokens', function (Blueprint $table) {
$table->dropForeign(['node']);
@ -23,7 +23,7 @@ class UpdateNodeConfigTokensColumns extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('node_configuration_tokens', function (Blueprint $table) {
$table->dropForeign(['node_id']);

View file

@ -9,7 +9,7 @@ class DeleteServiceExecutableOption extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->renameColumn('file', 'folder');
@ -22,7 +22,7 @@ class DeleteServiceExecutableOption extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->string('executable')->after('folder');

View file

@ -9,7 +9,7 @@ class AddNewServiceOptionsColumns extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropColumn('executable');
@ -27,7 +27,7 @@ class AddNewServiceOptionsColumns extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign(['config_from']);

View file

@ -7,7 +7,7 @@ class MigrateToNewServiceSystem extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
DB::transaction(function () {
$service = DB::table('services')->where('author', config('pterodactyl.service.core'))->where('folder', 'srcds')->first();
@ -32,7 +32,7 @@ class MigrateToNewServiceSystem extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
// Not doing reversals right now...
}

View file

@ -9,7 +9,7 @@ class ChangeServiceVariablesValidationRules extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_variables', function (Blueprint $table) {
$table->renameColumn('regex', 'rules');
@ -30,7 +30,7 @@ class ChangeServiceVariablesValidationRules extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('service_variables', function (Blueprint $table) {
$table->renameColumn('rules', 'regex');

View file

@ -85,7 +85,7 @@ EOF;
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('services', function (Blueprint $table) {
$table->text('index_file')->after('startup');
@ -105,7 +105,7 @@ EOF;
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('services', function (Blueprint $table) {
$table->dropColumn('index_file');

View file

@ -9,7 +9,7 @@ class RenameServicePacksToSingluarPacks extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('service_packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);
@ -25,7 +25,7 @@ class RenameServicePacksToSingluarPacks extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('packs', function (Blueprint $table) {
$table->dropForeign(['option_id']);

View file

@ -9,7 +9,7 @@ class AddLockedStatusToTable extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('packs', function (Blueprint $table) {
$table->boolean('locked')->default(false)->after('visible');
@ -19,7 +19,7 @@ class AddLockedStatusToTable extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('packs', function (Blueprint $table) {
$table->dropColumn('locked');

View file

@ -9,7 +9,7 @@ class ReOrganizeDatabaseServersToDatabaseHost extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign(['linked_node']);
@ -27,7 +27,7 @@ class ReOrganizeDatabaseServersToDatabaseHost extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('database_hosts', function (Blueprint $table) {
$table->dropForeign(['node_id']);

View file

@ -9,7 +9,7 @@ class CleanupDatabasesDatabase extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->dropForeign(['db_server']);
@ -23,7 +23,7 @@ class CleanupDatabasesDatabase extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('databases', function (Blueprint $table) {
$table->dropForeign(['database_host_id']);

View file

@ -9,7 +9,7 @@ class AddForeignKeyToPacks extends Migration
/**
* Run the migrations.
*/
public function up()
public function up(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->foreign('pack_id')->references('id')->on('packs');
@ -19,7 +19,7 @@ class AddForeignKeyToPacks extends Migration
/**
* Reverse the migrations.
*/
public function down()
public function down(): void
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['pack_id']);

Some files were not shown because too many files have changed in this diff Show more