1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 02:22:36 +01:00

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" - "1.0-develop"
jobs: jobs:
tests: mysql:
name: Tests name: MySQL
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php: [8.0, 8.1] php: [8.1]
database: ["mariadb:10.2", "mysql:8"] database: ["mariadb:10.2", "mariadb:10.9", "mysql:8"]
services: services:
database: database:
image: ${{ matrix.database }} image: docker.io/library/${{ matrix.database }}
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: testing MYSQL_DATABASE: testing
ports: ports:
- 3306 - 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 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: steps:
- name: Code Checkout - name: Code Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -53,9 +73,6 @@ jobs:
tools: composer:v2 tools: composer:v2
coverage: none coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies - name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
@ -69,4 +86,82 @@ jobs:
run: vendor/bin/phpunit tests/Integration run: vendor/bin/phpunit tests/Integration
env: env:
DB_PORT: ${{ job.services.database.ports[3306] }} 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 tools: composer:v2
coverage: none coverage: none
- name: Setup .env
run: cp .env.ci .env
- name: Install dependencies - name: Install dependencies
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist 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()), 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'); $type = $request->input('type');
// Either return all the servers the user has access to because they are an admin `?type=admin` or // 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 // 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 public function isViable(int $memory, int $disk): bool
{ {
$memoryLimit = $this->memory * (1 + ($this->memory_overallocate / 100)); $memoryLimit = $this->memory * (1.0 + ($this->memory_overallocate / 100.0));
$diskLimit = $this->disk * (1 + ($this->disk_overallocate / 100)); $diskLimit = $this->disk * (1.0 + ($this->disk_overallocate / 100.0));
return ($this->sum_memory + $memory) <= $memoryLimit && ($this->sum_disk + $disk) <= $diskLimit; 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 whereUsername($value)
* @method static Builder|User whereUuid($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 class User extends Model implements
AuthenticatableContract, AuthenticatableContract,

View File

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

View File

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

View File

@ -41,7 +41,7 @@ use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface;
class RepositoryServiceProvider extends ServiceProvider class RepositoryServiceProvider extends ServiceProvider
{ {
/** /**
* Register all of the repository bindings. * Register all the repository bindings.
*/ */
public function register() 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 // 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. // error because we request databases with a HashID, and not with a normal ID.
Route::model('database', Database::class); Route::model('database', Database::class);

View File

@ -80,7 +80,7 @@ class SettingsServiceProvider extends ServiceProvider
if (in_array($key, self::$encrypted)) { if (in_array($key, self::$encrypted)) {
try { try {
$value = $encrypter->decrypt($value); $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 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)) { if (!empty($nodes)) {
$query->whereIn('node_id', $nodes); $query->whereIn('node_id', $nodes);
} }
return $query->whereNotNull('server_id') return $query->whereNotNull('server_id')
->groupByRaw('CONCAT(node_id, ip)') ->groupByRaw('result')
->get() ->get()
->pluck('result') ->pluck('result')
->toArray(); ->toArray();
@ -89,7 +89,7 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos
if (!empty($discard)) { if (!empty($discard)) {
$query->whereNotIn( $query->whereNotIn(
$this->getBuilder()->raw('CONCAT_WS("-", node_id, ip)'), $this->getBuilder()->raw('CONCAT_WS(\'-\', node_id, ip)'),
$discard $discard
); );
} }

View File

@ -2,9 +2,12 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use PDO;
use RuntimeException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Repositories\Repository; use Pterodactyl\Repositories\Repository;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
@ -271,7 +274,17 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf
return sprintf('(%s)', $grammar->parameterize($record)); return sprintf('(%s)', $grammar->parameterize($record));
})->implode(', '); })->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); 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 public function getUsageStats(Node $node): array
{ {
$stats = $this->getBuilder() $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') ->join('servers', 'servers.node_id', '=', 'nodes.id')
->where('node_id', '=', $node->id) ->where('node_id', '=', $node->id)
->first(); ->first();
@ -54,7 +54,7 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
public function getUsageStatsRaw(Node $node): array public function getUsageStatsRaw(Node $node): array
{ {
$stats = $this->getBuilder()->select( $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(); )->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) { 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() $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']) ->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') ->leftJoin('servers', 'servers.node_id', '=', 'nodes.id')
->where('nodes.id', $node_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'); Assert::integer($this->memory, 'Memory usage must be an int, got %s');
$query = Node::query()->select('nodes.*') $query = Node::query()->select('nodes.*')
->selectRaw('IFNULL(SUM(servers.memory), 0) as sum_memory') ->selectRaw('COALESCE(SUM(servers.memory), 0) as sum_memory')
->selectRaw('IFNULL(SUM(servers.disk), 0) as sum_disk') ->selectRaw('COALESCE(SUM(servers.disk), 0) as sum_disk')
->leftJoin('servers', 'servers.node_id', '=', 'nodes.id') ->leftJoin('servers', 'servers.node_id', '=', 'nodes.id')
->where('nodes.public', 1); ->where('nodes.public', 1);
@ -82,8 +82,8 @@ class FindViableNodesService
} }
$results = $query->groupBy('nodes.id') $results = $query->groupBy('nodes.id')
->havingRaw('(IFNULL(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1 + (nodes.memory_overallocate / 100)))', [$this->memory]) ->havingRaw('(COALESCE(SUM(servers.memory), 0) + ?) <= (nodes.memory * (1.0 + (nodes.memory_overallocate / 100.0)))', [$this->memory])
->havingRaw('(IFNULL(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1 + (nodes.disk_overallocate / 100)))', [$this->disk]); ->havingRaw('(COALESCE(SUM(servers.disk), 0) + ?) <= (nodes.disk * (1.0 + (nodes.disk_overallocate / 100.0)))', [$this->disk]);
if (!is_null($page)) { if (!is_null($page)) {
$results = $results->paginate($perPage ?? 50, ['*'], 'page', $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); $output->writeln('<info>Seeding database for Integration tests...</info>' . PHP_EOL);
$kernel->call('db:seed'); $kernel->call('db:seed');
$output->writeln('<info>Database configured, running Integration tests...</info>' . PHP_EOL);
} else { } else {
$output->writeln(PHP_EOL . '<comment>Skipping database migrations...</comment>' . PHP_EOL); $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), 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 <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
@ -8,7 +9,7 @@ class AddAllocationsTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
Schema::create('allocations', function (Blueprint $table) { Schema::create('allocations', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
@ -23,7 +24,7 @@ class AddAllocationsTable extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::dropIfExists('allocations'); Schema::dropIfExists('allocations');
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,11 +9,10 @@ class AddForeignApiPermissions extends Migration
/** /**
* Run the migrations. * 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) { 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'); $table->foreign('key_id')->references('id')->on('api_keys');
}); });
} }
@ -21,13 +20,13 @@ class AddForeignApiPermissions extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('api_permissions', function (Blueprint $table) { Schema::table('api_permissions', function (Blueprint $table) {
$table->dropForeign('api_permissions_key_id_foreign'); $table->dropForeign(['key_id']);
$table->dropIndex('api_permissions_key_id_foreign'); $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. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
Schema::table('database_servers', function (Blueprint $table) { Schema::table('database_servers', function (Blueprint $table) {
$table->foreign('linked_node')->references('id')->on('nodes'); $table->foreign('linked_node')->references('id')->on('nodes');
@ -19,11 +19,11 @@ class AddForeignDatabaseServers extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('database_servers', function (Blueprint $table) { Schema::table('database_servers', function (Blueprint $table) {
$table->dropForeign('database_servers_linked_node_foreign'); $table->dropForeign(['linked_node']);
$table->dropIndex('database_servers_linked_node_foreign'); $table->dropIndex(['linked_node']);
}); });
} }
} }

View File

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

View File

@ -9,11 +9,10 @@ class AddForeignNodes extends Migration
/** /**
* Run the migrations. * 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) { Schema::table('nodes', function (Blueprint $table) {
$table->integer('location', false, true)->nullable(false)->change();
$table->foreign('location')->references('id')->on('locations'); $table->foreign('location')->references('id')->on('locations');
}); });
} }
@ -21,13 +20,13 @@ class AddForeignNodes extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->dropForeign('nodes_location_foreign'); $table->dropForeign(['location']);
$table->dropIndex('nodes_location_foreign'); $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. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
@ -20,14 +20,14 @@ class AddForeignPermissions extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('permissions', function (Blueprint $table) { Schema::table('permissions', function (Blueprint $table) {
$table->dropForeign('permissions_user_id_foreign'); $table->dropForeign(['user_id']);
$table->dropForeign('permissions_server_id_foreign'); $table->dropIndex(['user_id']);
$table->dropIndex('permissions_user_id_foreign'); $table->dropForeign(['server_id']);
$table->dropIndex('permissions_server_id_foreign'); $table->dropIndex(['server_id']);
}); });
} }
} }

View File

@ -9,14 +9,11 @@ class AddForeignServerVariables extends Migration
/** /**
* Run the migrations. * 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) { 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('server_id')->references('id')->on('servers');
$table->foreign('variable_id')->references('id')->on('service_variables'); $table->foreign('variable_id')->references('id')->on('service_variables');
}); });
@ -25,16 +22,13 @@ class AddForeignServerVariables extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('server_variables', function (Blueprint $table) { Schema::table('server_variables', function (Blueprint $table) {
$table->dropForeign(['server_id']); $table->dropForeign(['server_id']);
$table->dropForeign(['variable_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. * 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) { Schema::table('service_options', function (Blueprint $table) {
$table->integer('parent_service', false, true)->change();
$table->foreign('parent_service')->references('id')->on('services'); $table->foreign('parent_service')->references('id')->on('services');
}); });
} }
@ -21,13 +20,13 @@ class AddForeignServiceOptions extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('service_options', function (Blueprint $table) { Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('service_options_parent_service_foreign'); $table->dropForeign(['parent_service']);
$table->dropIndex('service_options_parent_service_foreign'); $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. * 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) { Schema::table('service_variables', function (Blueprint $table) {
$table->integer('option_id', false, true)->change();
$table->foreign('option_id')->references('id')->on('service_options'); $table->foreign('option_id')->references('id')->on('service_options');
}); });
} }
@ -21,13 +20,13 @@ class AddForeignServiceVariables extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('service_variables', function (Blueprint $table) { Schema::table('service_variables', function (Blueprint $table) {
$table->dropForeign('service_variables_option_id_foreign'); $table->dropForeign(['option_id']);
$table->dropIndex('service_variables_option_id_foreign'); $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. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
Schema::table('subusers', function (Blueprint $table) { Schema::table('subusers', function (Blueprint $table) {
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
@ -20,14 +20,14 @@ class AddForeignSubusers extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('subusers', function (Blueprint $table) { Schema::table('subusers', function (Blueprint $table) {
$table->dropForeign('subusers_user_id_foreign'); $table->dropForeign(['user_id']);
$table->dropForeign('subusers_server_id_foreign'); $table->dropIndex(['user_id']);
$table->dropIndex('subusers_user_id_foreign'); $table->dropForeign(['server_id']);
$table->dropIndex('subusers_server_id_foreign'); $table->dropIndex(['server_id']);
}); });
} }
} }

View File

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

View File

@ -7,7 +7,7 @@ class AddArkServiceOptionFixed extends Migration
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
DB::transaction(function () { DB::transaction(function () {
$service = DB::table('services')->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();
@ -73,7 +73,7 @@ class AddArkServiceOptionFixed extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
DB::transaction(function () { DB::transaction(function () {
$service = DB::table('services')->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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,10 +9,10 @@ class UpdateAPIKeyColumnNames extends Migration
/** /**
* Run the migrations. * Run the migrations.
*/ */
public function up() public function up(): void
{ {
Schema::table('api_keys', function (Blueprint $table) { 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->renameColumn('user', 'user_id');
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
@ -22,10 +22,10 @@ class UpdateAPIKeyColumnNames extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down() public function down(): void
{ {
Schema::table('api_keys', function (Blueprint $table) { 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->renameColumn('user_id', 'user');
$table->foreign('user')->references('id')->on('users'); $table->foreign('user')->references('id')->on('users');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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