From 8ee5d6aabd1575adf9b73e5423d784c75357645b Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sat, 15 Jun 2024 14:46:10 +0200 Subject: [PATCH 01/26] Add missing "search" translations (#393) --- lang/en/search.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lang/en/search.php diff --git a/lang/en/search.php b/lang/en/search.php new file mode 100644 index 000000000..f7e545876 --- /dev/null +++ b/lang/en/search.php @@ -0,0 +1,9 @@ + 'Please enter at least three characters to begin searching.', + 'term' => [ + 'label' => 'Search term', + 'description' => 'Enter a server name, uuid, or allocation to begin searching.', + ], +]; From fe4e6271fbb90d26fb6d340134525f332f550e76 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 15 Jun 2024 12:33:33 -0400 Subject: [PATCH 02/26] Set minValue Closes #397 --- app/Filament/Resources/ServerResource/Pages/EditServer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index c51a9a569..b8bfd8332 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -381,14 +381,17 @@ class EditServer extends EditRecord Forms\Components\TextInput::make('allocation_limit') ->suffixIcon('tabler-network') ->required() + ->minValue(0) ->numeric(), Forms\Components\TextInput::make('database_limit') ->suffixIcon('tabler-database') ->required() + ->minValue(0) ->numeric(), Forms\Components\TextInput::make('backup_limit') ->suffixIcon('tabler-copy-check') ->required() + ->minValue(0) ->numeric(), ]), Forms\Components\Fieldset::make('Docker Settings') From f4c3c89c1781846b675f2caf26b3eb23bca67759 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 15 Jun 2024 12:36:15 -0400 Subject: [PATCH 03/26] Also add that here Prevent 500's on server create --- app/Filament/Resources/ServerResource/Pages/CreateServer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Filament/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Resources/ServerResource/Pages/CreateServer.php index 9d55bcaed..63ce48b32 100644 --- a/app/Filament/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Resources/ServerResource/Pages/CreateServer.php @@ -655,18 +655,21 @@ class CreateServer extends CreateRecord ->suffixIcon('tabler-network') ->required() ->numeric() + ->minValue(0) ->default(0), Forms\Components\TextInput::make('database_limit') ->label('Databases') ->suffixIcon('tabler-database') ->required() ->numeric() + ->minValue(0) ->default(0), Forms\Components\TextInput::make('backup_limit') ->label('Backups') ->suffixIcon('tabler-copy-check') ->required() ->numeric() + ->minValue(0) ->default(0), ]), Forms\Components\Fieldset::make('Docker Settings') From 59bbb637392a6e701bb90085d963dd1c8b471843 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sat, 15 Jun 2024 23:20:08 +0200 Subject: [PATCH 04/26] Fix queue worker file when using redis (#399) --- .../Commands/Environment/QueueWorkerServiceCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index 93fe6223f..607f2ae9b 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -24,7 +24,7 @@ class QueueWorkerServiceCommand extends Command $fileExists = file_exists($path); if ($fileExists && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { - $this->line('Creation of queue worker service file aborted because serive file already exists.'); + $this->line('Creation of queue worker service file aborted because service file already exists.'); return; } @@ -32,7 +32,8 @@ class QueueWorkerServiceCommand extends Command $user = $this->option('user') ?? $this->ask('Webserver User', 'www-data'); $group = $this->option('group') ?? $this->ask('Webserver Group', 'www-data'); - $afterRedis = $this->option('use-redis') ? '\nAfter=redis-server.service' : ''; + $afterRedis = $this->option('use-redis') ? ' +After=redis-server.service' : ''; $basePath = base_path(); From 482e8ed6b2b0ea326c798f86ae350a9f8a51cc1c Mon Sep 17 00:00:00 2001 From: notCharles Date: Sun, 16 Jun 2024 13:50:28 -0400 Subject: [PATCH 05/26] Add Databases to Edit Server --- .../Resources/EggResource/Pages/ListEggs.php | 3 +- .../ServerResource/Pages/EditServer.php | 46 +++++++++++++++++-- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/app/Filament/Resources/EggResource/Pages/ListEggs.php b/app/Filament/Resources/EggResource/Pages/ListEggs.php index e51f3bbfc..2547ce2cd 100644 --- a/app/Filament/Resources/EggResource/Pages/ListEggs.php +++ b/app/Filament/Resources/EggResource/Pages/ListEggs.php @@ -29,8 +29,7 @@ class ListEggs extends ListRecords ->columns([ Tables\Columns\TextColumn::make('id') ->label('Id') - ->searchable() - ->sortable(), + ->hidden(), Tables\Columns\TextColumn::make('name') ->icon('tabler-egg') ->description(fn ($record): ?string => (strlen($record->description) > 120) ? substr($record->description, 0, 120).'...' : $record->description) diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index b8bfd8332..eb345aa77 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -2,6 +2,10 @@ namespace App\Filament\Resources\ServerResource\Pages; +use App\Services\Databases\DatabaseManagementService; +use Filament\Forms\Components\Actions\Action; +use Filament\Forms\Components\Repeater; +use Filament\Forms\Components\TextInput; use LogicException; use App\Filament\Resources\ServerResource; use App\Http\Controllers\Admin\ServersController; @@ -587,9 +591,41 @@ class EditServer extends EditRecord Tabs\Tab::make('Databases') ->icon('tabler-database') ->schema([ - Forms\Components\Placeholder::make('soon') - ->label('Soon™'), - ]), + Repeater::make('databases') + ->columnSpanFull() + ->grid() + ->schema([ + TextInput::make('db_name') + ->label('Database Name') + ->hintAction( + Action::make('Delete') + ->color('danger') + ->icon('tabler-trash') + ->action(fn (DatabaseManagementService $databaseManagementService, $record) => $databaseManagementService->delete($record)) + ) + ->formatStateUsing(fn ($record) => $record->database) + ->readOnly(), + TextInput::make('db_username') + ->label('Username') + ->inlineLabel() + ->formatStateUsing(fn ($record) => $record->username) + ->readOnly(), + TextInput::make('db_password') + ->label('Password') + ->inlineLabel() + ->formatStateUsing(fn ($record) => $record->password) + ->readOnly(), + TextInput::make('db_max_connections') + ->label('Max Connections') + ->inlineLabel() + ->formatStateUsing(fn ($record) => $record->max_connections < 1 ? 'Unlimited' : $record->max_connections) + ->readOnly(), + ]) + ->relationship('databases') + ->deletable(false) + ->addable(false) + ->columnSpan(4), + ])->columns(4), Tabs\Tab::make('Actions') ->icon('tabler-settings') ->schema([ @@ -709,7 +745,7 @@ class EditServer extends EditRecord protected function transferServer(Form $form): Form { return $form - ->columns(2) + ->columns() ->schema([ Forms\Components\Select::make('toNode') ->label('New Node'), @@ -724,6 +760,8 @@ class EditServer extends EditRecord Actions\DeleteAction::make('Delete') ->successRedirectUrl(route('filament.admin.resources.servers.index')) ->color('danger') + ->disabled(fn (Server $server) => $server->databases()->count() > 0) + ->label(fn (Server $server) => $server->databases()->count() > 0 ? 'Server has a Database' : 'Delete') ->after(fn (Server $server) => resolve(ServerDeletionService::class)->handle($server)) ->requiresConfirmation(), Actions\Action::make('console') From aa08e774a1eb8502e7d8456cc4f5c70b905fd6a0 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:56:18 +0200 Subject: [PATCH 06/26] Fix varchar(191) by replacing with 255 #135 (#376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Nullable * Edit filament & AppServiceProvider * Pint * Patch tests * Actually patching tests * Actually patching tests * Remove length * Remove defaultStringLength * Let’s see the differences --------- Co-authored-by: Lance Pioch --- .../Pages/CreateDatabaseHost.php | 6 +- .../Pages/EditDatabaseHost.php | 6 +- .../DatabaseResource/Pages/CreateDatabase.php | 6 +- .../DatabaseResource/Pages/EditDatabase.php | 6 +- .../Resources/EggResource/Pages/CreateEgg.php | 14 +- .../Resources/EggResource/Pages/EditEgg.php | 16 +- .../MountResource/Pages/CreateMount.php | 4 +- .../MountResource/Pages/EditMount.php | 4 +- .../NodeResource/Pages/CreateNode.php | 2 +- .../Resources/NodeResource/Pages/EditNode.php | 2 +- .../ServerResource/Pages/CreateServer.php | 4 +- .../ServerResource/Pages/EditServer.php | 4 +- .../UserResource/Pages/EditProfile.php | 4 +- .../Resources/UserResource/Pages/EditUser.php | 4 +- .../UserResource/Pages/ListUsers.php | 4 +- .../Requests/Admin/Egg/EggFormRequest.php | 4 +- .../Admin/Egg/EggVariableFormRequest.php | 4 +- .../Admin/Node/AllocationFormRequest.php | 2 +- .../Settings/AdvancedSettingsFormRequest.php | 4 +- .../Settings/BaseSettingsFormRequest.php | 2 +- .../Settings/MailSettingsFormRequest.php | 6 +- .../Allocations/StoreAllocationRequest.php | 2 +- .../Servers/Backups/StoreBackupRequest.php | 2 +- .../Servers/Subusers/StoreSubuserRequest.php | 2 +- app/Models/AuditLog.php | 4 +- app/Models/DatabaseHost.php | 2 +- app/Models/Egg.php | 4 +- app/Models/EggVariable.php | 4 +- app/Models/Mount.php | 2 +- app/Models/Schedule.php | 2 +- app/Models/Server.php | 6 +- app/Models/Setting.php | 2 +- app/Models/User.php | 10 +- app/Providers/AppServiceProvider.php | 3 - .../2024_06_11_220722_update_field_length.php | 289 ++++ database/schema/mysql-schema.sql | 1175 +++++++++-------- .../Subuser/CreateServerSubuserTest.php | 4 +- 37 files changed, 958 insertions(+), 663 deletions(-) create mode 100644 database/migrations/2024_06_11_220722_update_field_length.php diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php index dd37e5c26..e33066539 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php @@ -36,7 +36,7 @@ class CreateDatabaseHost extends CreateRecord ->required() ->live(onBlur: true) ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('port') ->columnSpan(1) ->helperText('The port that MySQL is running on for this host.') @@ -57,12 +57,12 @@ class CreateDatabaseHost extends CreateRecord Forms\Components\TextInput::make('username') ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('password') ->helperText('The password for the database user.') ->password() ->revealable() - ->maxLength(191) + ->maxLength(255) ->required(), Forms\Components\Select::make('node_id') ->searchable() diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php index 1e46e6055..16a3ec5a1 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php @@ -32,7 +32,7 @@ class EditDatabaseHost extends EditRecord ->required() ->live(onBlur: true) ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('port') ->columnSpan(1) ->helperText('The port that MySQL is running on for this host.') @@ -52,12 +52,12 @@ class EditDatabaseHost extends EditRecord Forms\Components\TextInput::make('username') ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('password') ->helperText('The password for the database user.') ->password() ->revealable() - ->maxLength(191) + ->maxLength(255) ->required(), Forms\Components\Select::make('node_id') ->searchable() diff --git a/app/Filament/Resources/DatabaseResource/Pages/CreateDatabase.php b/app/Filament/Resources/DatabaseResource/Pages/CreateDatabase.php index 041a79db6..c56b5f586 100644 --- a/app/Filament/Resources/DatabaseResource/Pages/CreateDatabase.php +++ b/app/Filament/Resources/DatabaseResource/Pages/CreateDatabase.php @@ -25,14 +25,14 @@ class CreateDatabase extends CreateRecord ->numeric(), Forms\Components\TextInput::make('database') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('remote') ->required() - ->maxLength(191) + ->maxLength(255) ->default('%'), Forms\Components\TextInput::make('username') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('password') ->password() ->revealable() diff --git a/app/Filament/Resources/DatabaseResource/Pages/EditDatabase.php b/app/Filament/Resources/DatabaseResource/Pages/EditDatabase.php index 2ff5af76b..aa8754ce1 100644 --- a/app/Filament/Resources/DatabaseResource/Pages/EditDatabase.php +++ b/app/Filament/Resources/DatabaseResource/Pages/EditDatabase.php @@ -26,14 +26,14 @@ class EditDatabase extends EditRecord ->numeric(), Forms\Components\TextInput::make('database') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('remote') ->required() - ->maxLength(191) + ->maxLength(255) ->default('%'), Forms\Components\TextInput::make('username') ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('password') ->password() ->revealable() diff --git a/app/Filament/Resources/EggResource/Pages/CreateEgg.php b/app/Filament/Resources/EggResource/Pages/CreateEgg.php index 5ae0cb80f..f05ec2969 100644 --- a/app/Filament/Resources/EggResource/Pages/CreateEgg.php +++ b/app/Filament/Resources/EggResource/Pages/CreateEgg.php @@ -25,11 +25,11 @@ class CreateEgg extends CreateRecord ->schema([ Forms\Components\TextInput::make('name') ->required() - ->maxLength(191) + ->maxLength(255) ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]) ->helperText('A simple, human-readable name to use as an identifier for this Egg.'), Forms\Components\TextInput::make('author') - ->maxLength(191) + ->maxLength(255) ->required() ->email() ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]) @@ -88,7 +88,7 @@ class CreateEgg extends CreateRecord ->helperText('If you would like to default to settings from another Egg select it from the menu above.'), Forms\Components\TextInput::make('config_stop') ->required() - ->maxLength(191) + ->maxLength(255) ->label('Stop Command') ->helperText('The command that should be sent to server processes to stop them gracefully. If you need to send a SIGINT you should enter ^C here.'), Forms\Components\Textarea::make('config_startup')->rows(10)->json() @@ -140,7 +140,7 @@ class CreateEgg extends CreateRecord Forms\Components\TextInput::make('name') ->live() ->debounce(750) - ->maxLength(191) + ->maxLength(255) ->columnSpanFull() ->afterStateUpdated(fn (Forms\Set $set, $state) => $set('env_variable', str($state)->trim()->snake()->upper()->toString()) ) @@ -148,13 +148,13 @@ class CreateEgg extends CreateRecord Forms\Components\Textarea::make('description')->columnSpanFull(), Forms\Components\TextInput::make('env_variable') ->label('Environment Variable') - ->maxLength(191) + ->maxLength(255) ->prefix('{{') ->suffix('}}') ->hintIcon('tabler-code') ->hintIconTooltip(fn ($state) => "{{{$state}}}") ->required(), - Forms\Components\TextInput::make('default_value')->maxLength(191), + Forms\Components\TextInput::make('default_value')->maxLength(255), Forms\Components\Fieldset::make('User Permissions') ->schema([ Forms\Components\Checkbox::make('user_viewable')->label('Viewable'), @@ -173,7 +173,7 @@ class CreateEgg extends CreateRecord Forms\Components\TextInput::make('script_container') ->required() - ->maxLength(191) + ->maxLength(255) ->default('alpine:3.4'), Forms\Components\Select::make('script_entry') diff --git a/app/Filament/Resources/EggResource/Pages/EditEgg.php b/app/Filament/Resources/EggResource/Pages/EditEgg.php index 9a51bdc78..9e87ec97b 100644 --- a/app/Filament/Resources/EggResource/Pages/EditEgg.php +++ b/app/Filament/Resources/EggResource/Pages/EditEgg.php @@ -25,7 +25,7 @@ class EditEgg extends EditRecord ->schema([ Forms\Components\TextInput::make('name') ->required() - ->maxLength(191) + ->maxLength(255) ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 1]) ->helperText('A simple, human-readable name to use as an identifier for this Egg.'), Forms\Components\TextInput::make('uuid') @@ -42,7 +42,7 @@ class EditEgg extends EditRecord ->helperText('A description of this Egg that will be displayed throughout the Panel as needed.'), Forms\Components\TextInput::make('author') ->required() - ->maxLength(191) + ->maxLength(255) ->email() ->disabled() ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]) @@ -95,7 +95,7 @@ class EditEgg extends EditRecord ->relationship('configFrom', 'name', ignoreRecord: true) ->helperText('If you would like to default to settings from another Egg select it from the menu above.'), Forms\Components\TextInput::make('config_stop') - ->maxLength(191) + ->maxLength(255) ->label('Stop Command') ->helperText('The command that should be sent to server processes to stop them gracefully. If you need to send a SIGINT you should enter ^C here.'), Forms\Components\Textarea::make('config_startup')->rows(10)->json() @@ -143,7 +143,7 @@ class EditEgg extends EditRecord Forms\Components\TextInput::make('name') ->live() ->debounce(750) - ->maxLength(191) + ->maxLength(255) ->columnSpanFull() ->afterStateUpdated(fn (Forms\Set $set, $state) => $set('env_variable', str($state)->trim()->snake()->upper()->toString()) ) @@ -151,13 +151,13 @@ class EditEgg extends EditRecord Forms\Components\Textarea::make('description')->columnSpanFull(), Forms\Components\TextInput::make('env_variable') ->label('Environment Variable') - ->maxLength(191) + ->maxLength(255) ->prefix('{{') ->suffix('}}') ->hintIcon('tabler-code') ->hintIconTooltip(fn ($state) => "{{{$state}}}") ->required(), - Forms\Components\TextInput::make('default_value')->maxLength(191), + Forms\Components\TextInput::make('default_value')->maxLength(255), Forms\Components\Fieldset::make('User Permissions') ->schema([ Forms\Components\Checkbox::make('user_viewable')->label('Viewable'), @@ -176,12 +176,12 @@ class EditEgg extends EditRecord Forms\Components\TextInput::make('script_container') ->required() - ->maxLength(191) + ->maxLength(255) ->default('alpine:3.4'), Forms\Components\TextInput::make('script_entry') ->required() - ->maxLength(191) + ->maxLength(255) ->default('ash'), MonacoEditor::make('script_install') diff --git a/app/Filament/Resources/MountResource/Pages/CreateMount.php b/app/Filament/Resources/MountResource/Pages/CreateMount.php index b6abba6fe..0aec8981f 100644 --- a/app/Filament/Resources/MountResource/Pages/CreateMount.php +++ b/app/Filament/Resources/MountResource/Pages/CreateMount.php @@ -48,11 +48,11 @@ class CreateMount extends CreateRecord Forms\Components\TextInput::make('source') ->required() ->helperText('File path on the host system to mount to a container.') - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('target') ->required() ->helperText('Where the mount will be accessible inside a container.') - ->maxLength(191), + ->maxLength(255), Forms\Components\ToggleButtons::make('user_mountable') ->hidden() ->label('User mountable?') diff --git a/app/Filament/Resources/MountResource/Pages/EditMount.php b/app/Filament/Resources/MountResource/Pages/EditMount.php index 15b3a5bdf..6e838ed32 100644 --- a/app/Filament/Resources/MountResource/Pages/EditMount.php +++ b/app/Filament/Resources/MountResource/Pages/EditMount.php @@ -45,11 +45,11 @@ class EditMount extends EditRecord Forms\Components\TextInput::make('source') ->required() ->helperText('File path on the host system to mount to a container.') - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('target') ->required() ->helperText('Where the mount will be accessible inside a container.') - ->maxLength(191), + ->maxLength(255), Forms\Components\ToggleButtons::make('user_mountable') ->hidden() ->label('User mountable?') diff --git a/app/Filament/Resources/NodeResource/Pages/CreateNode.php b/app/Filament/Resources/NodeResource/Pages/CreateNode.php index 0dbf4c2b4..23b192457 100644 --- a/app/Filament/Resources/NodeResource/Pages/CreateNode.php +++ b/app/Filament/Resources/NodeResource/Pages/CreateNode.php @@ -93,7 +93,7 @@ class CreateNode extends CreateRecord $set('dns', false); }) - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('ip') ->disabled() diff --git a/app/Filament/Resources/NodeResource/Pages/EditNode.php b/app/Filament/Resources/NodeResource/Pages/EditNode.php index dded9ffd2..f9286cf70 100644 --- a/app/Filament/Resources/NodeResource/Pages/EditNode.php +++ b/app/Filament/Resources/NodeResource/Pages/EditNode.php @@ -94,7 +94,7 @@ class EditNode extends EditRecord $set('dns', false); }) - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('ip') ->disabled() diff --git a/app/Filament/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Resources/ServerResource/Pages/CreateServer.php index 63ce48b32..d62a7d31e 100644 --- a/app/Filament/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Resources/ServerResource/Pages/CreateServer.php @@ -64,7 +64,7 @@ class CreateServer extends CreateRecord 'lg' => 3, ]) ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\Select::make('owner_id') ->prefixIcon('tabler-user') @@ -403,7 +403,7 @@ class CreateServer extends CreateRecord $text = Forms\Components\TextInput::make('variable_value') ->hidden($this->shouldHideComponent(...)) - ->maxLength(191) + ->maxLength(255) ->required(fn (Forms\Get $get) => in_array('required', explode('|', $get('rules')))) ->rules( fn (Forms\Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) { diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index eb345aa77..896d18bea 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -125,7 +125,7 @@ class EditServer extends EditRecord 'lg' => 3, ]) ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\Select::make('owner_id') ->prefixIcon('tabler-user') @@ -172,7 +172,7 @@ class EditServer extends EditRecord 'md' => 2, 'lg' => 3, ]) - ->maxLength(191), + ->maxLength(255), Forms\Components\Select::make('node_id') ->label('Node') ->relationship('node', 'name') diff --git a/app/Filament/Resources/UserResource/Pages/EditProfile.php b/app/Filament/Resources/UserResource/Pages/EditProfile.php index f59a5b56e..c8ce603a5 100644 --- a/app/Filament/Resources/UserResource/Pages/EditProfile.php +++ b/app/Filament/Resources/UserResource/Pages/EditProfile.php @@ -52,7 +52,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile ->label(trans('strings.username')) ->disabled() ->readOnly() - ->maxLength(191) + ->maxLength(255) ->unique(ignoreRecord: true) ->autofocus(), @@ -61,7 +61,7 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile ->label(trans('strings.email')) ->email() ->required() - ->maxLength(191) + ->maxLength(255) ->unique(ignoreRecord: true), TextInput::make('password') diff --git a/app/Filament/Resources/UserResource/Pages/EditUser.php b/app/Filament/Resources/UserResource/Pages/EditUser.php index 4750ce28f..6e6386405 100644 --- a/app/Filament/Resources/UserResource/Pages/EditUser.php +++ b/app/Filament/Resources/UserResource/Pages/EditUser.php @@ -20,8 +20,8 @@ class EditUser extends EditRecord return $form ->schema([ Section::make()->schema([ - Forms\Components\TextInput::make('username')->required()->maxLength(191), - Forms\Components\TextInput::make('email')->email()->required()->maxLength(191), + Forms\Components\TextInput::make('username')->required()->maxLength(255), + Forms\Components\TextInput::make('email')->email()->required()->maxLength(255), Forms\Components\TextInput::make('password') ->dehydrateStateUsing(fn (string $state): string => Hash::make($state)) diff --git a/app/Filament/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Resources/UserResource/Pages/ListUsers.php index 363adb255..89d53de6b 100644 --- a/app/Filament/Resources/UserResource/Pages/ListUsers.php +++ b/app/Filament/Resources/UserResource/Pages/ListUsers.php @@ -85,12 +85,12 @@ class ListUsers extends ListRecords Forms\Components\TextInput::make('username') ->alphaNum() ->required() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('email') ->email() ->required() ->unique() - ->maxLength(191), + ->maxLength(255), Forms\Components\TextInput::make('password') ->hintIcon('tabler-question-mark') diff --git a/app/Http/Requests/Admin/Egg/EggFormRequest.php b/app/Http/Requests/Admin/Egg/EggFormRequest.php index 09f6e014b..d1af8a085 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -9,14 +9,14 @@ class EggFormRequest extends AdminFormRequest public function rules(): array { $rules = [ - 'name' => 'required|string|max:191', + 'name' => 'required|string|max:255', 'description' => 'nullable|string', 'docker_images' => 'required|string', 'force_outgoing_ip' => 'sometimes|boolean', 'file_denylist' => 'array', 'startup' => 'required|string', 'config_from' => 'sometimes|bail|nullable|numeric', - 'config_stop' => 'required_without:config_from|nullable|string|max:191', + 'config_stop' => 'required_without:config_from|nullable|string|max:255', 'config_startup' => 'required_without:config_from|nullable|json', 'config_logs' => 'required_without:config_from|nullable|json', 'config_files' => 'required_without:config_from|nullable|json', diff --git a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php index 3177fae02..c6720aa2c 100644 --- a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php @@ -13,9 +13,9 @@ class EggVariableFormRequest extends AdminFormRequest public function rules(): array { return [ - 'name' => 'required|string|min:1|max:191', + 'name' => 'required|string|min:1|max:255', 'description' => 'sometimes|nullable|string', - 'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES, + 'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES, 'options' => 'sometimes|required|array', 'rules' => 'bail|required|string', 'default_value' => 'present', diff --git a/app/Http/Requests/Admin/Node/AllocationFormRequest.php b/app/Http/Requests/Admin/Node/AllocationFormRequest.php index 1bd39c405..720488e18 100644 --- a/app/Http/Requests/Admin/Node/AllocationFormRequest.php +++ b/app/Http/Requests/Admin/Node/AllocationFormRequest.php @@ -10,7 +10,7 @@ class AllocationFormRequest extends AdminFormRequest { return [ 'allocation_ip' => 'required|string', - 'allocation_alias' => 'sometimes|nullable|string|max:191', + 'allocation_alias' => 'sometimes|nullable|string|max:255', 'allocation_ports' => 'required|array', ]; } diff --git a/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php index 8530b9ce4..f02f60d01 100644 --- a/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php @@ -13,8 +13,8 @@ class AdvancedSettingsFormRequest extends AdminFormRequest { return [ 'recaptcha:enabled' => 'required|in:true,false', - 'recaptcha:secret_key' => 'required|string|max:191', - 'recaptcha:website_key' => 'required|string|max:191', + 'recaptcha:secret_key' => 'required|string|max:255', + 'recaptcha:website_key' => 'required|string|max:255', 'panel:guzzle:timeout' => 'required|integer|between:1,60', 'panel:guzzle:connect_timeout' => 'required|integer|between:1,60', 'panel:client_features:allocations:enabled' => 'required|in:true,false', diff --git a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php index 270e35d49..eb84e25cf 100644 --- a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php @@ -13,7 +13,7 @@ class BaseSettingsFormRequest extends AdminFormRequest public function rules(): array { return [ - 'app:name' => 'required|string|max:191', + 'app:name' => 'required|string|max:255', 'panel:auth:2fa_required' => 'required|integer|in:0,1,2', 'app:locale' => ['required', 'string', Rule::in(array_keys($this->getAvailableLanguages()))], ]; diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index da34a21c1..9e62869d8 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -16,10 +16,10 @@ class MailSettingsFormRequest extends AdminFormRequest 'mail:mailers:smtp:host' => 'required|string', 'mail:mailers:smtp:port' => 'required|integer|between:1,65535', 'mail:mailers:smtp:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])], - 'mail:mailers:smtp:username' => 'nullable|string|max:191', - 'mail:mailers:smtp:password' => 'nullable|string|max:191', + 'mail:mailers:smtp:username' => 'nullable|string|max:255', + 'mail:mailers:smtp:password' => 'nullable|string|max:255', 'mail:from:address' => 'required|string|email', - 'mail:from:name' => 'nullable|string|max:191', + 'mail:from:name' => 'nullable|string|max:255', ]; } diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index a87e8cc69..397f72093 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -15,7 +15,7 @@ class StoreAllocationRequest extends ApplicationApiRequest { return [ 'ip' => 'required|string', - 'alias' => 'sometimes|nullable|string|max:191', + 'alias' => 'sometimes|nullable|string|max:255', 'ports' => 'required|array', 'ports.*' => 'string', ]; diff --git a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php index 9840d963e..d028bd3e8 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php @@ -15,7 +15,7 @@ class StoreBackupRequest extends ClientApiRequest public function rules(): array { return [ - 'name' => 'nullable|string|max:191', + 'name' => 'nullable|string|max:255', 'is_locked' => 'nullable|boolean', 'ignored' => 'nullable|string', ]; diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php index 14a1d6c2c..e04a95c54 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php @@ -14,7 +14,7 @@ class StoreSubuserRequest extends SubuserRequest public function rules(): array { return [ - 'email' => 'required|email|between:1,191', + 'email' => 'required|email|between:1,255', 'permissions' => 'required|array', 'permissions.*' => 'string', ]; diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index aa9d57d6a..d091773ea 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -16,8 +16,8 @@ class AuditLog extends Model public static array $validationRules = [ 'uuid' => 'required|uuid', - 'action' => 'required|string|max:191', - 'subaction' => 'nullable|string|max:191', + 'action' => 'required|string|max:255', + 'subaction' => 'nullable|string|max:255', 'device' => 'array', 'device.ip_address' => 'ip', 'device.user_agent' => 'string', diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index 159e17261..278cee9b4 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -46,7 +46,7 @@ class DatabaseHost extends Model * Validation rules to assign to this model. */ public static array $validationRules = [ - 'name' => 'required|string|max:191', + 'name' => 'required|string|max:255', 'host' => 'required|string', 'port' => 'required|numeric|between:1,65535', 'username' => 'required|string|max:32', diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 3e194bae3..5586b4c1f 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -105,7 +105,7 @@ class Egg extends Model public static array $validationRules = [ 'uuid' => 'required|string|size:36', - 'name' => 'required|string|max:191', + 'name' => 'required|string|max:255', 'description' => 'string|nullable', 'features' => 'array|nullable', 'author' => 'required|string|email', @@ -115,7 +115,7 @@ class Egg extends Model 'docker_images.*' => 'required|string', 'startup' => 'required|nullable|string', 'config_from' => 'sometimes|bail|nullable|numeric|exists:eggs,id', - 'config_stop' => 'required_without:config_from|nullable|string|max:191', + 'config_stop' => 'required_without:config_from|nullable|string|max:255', 'config_startup' => 'required_without:config_from|nullable|json', 'config_logs' => 'required_without:config_from|nullable|json', 'config_files' => 'required_without:config_from|nullable|json', diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index 568830a5b..c589d9534 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -52,9 +52,9 @@ class EggVariable extends Model public static array $validationRules = [ 'egg_id' => 'exists:eggs,id', 'sort' => 'nullable', - 'name' => 'required|string|between:1,191', + 'name' => 'required|string|between:1,255', 'description' => 'string', - 'env_variable' => 'required|alphaDash|between:1,191|notIn:' . self::RESERVED_ENV_NAMES, + 'env_variable' => 'required|alphaDash|between:1,255|notIn:' . self::RESERVED_ENV_NAMES, 'default_value' => 'string', 'user_viewable' => 'boolean', 'user_editable' => 'boolean', diff --git a/app/Models/Mount.php b/app/Models/Mount.php index aa335b990..223603805 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -41,7 +41,7 @@ class Mount extends Model */ public static array $validationRules = [ 'name' => 'required|string|min:2|max:64|unique:mounts,name', - 'description' => 'nullable|string|max:191', + 'description' => 'nullable|string|max:255', 'source' => 'required|string', 'target' => 'required|string', 'read_only' => 'sometimes|boolean', diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 7042d25a4..ae7b9baec 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -76,7 +76,7 @@ class Schedule extends Model public static array $validationRules = [ 'server_id' => 'required|exists:servers,id', - 'name' => 'required|string|max:191', + 'name' => 'required|string|max:255', 'cron_day_of_week' => 'required|string', 'cron_month' => 'required|string', 'cron_day_of_month' => 'required|string', diff --git a/app/Models/Server.php b/app/Models/Server.php index 5aca895dd..adb5ab98e 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -139,9 +139,9 @@ class Server extends Model protected $guarded = ['id', self::CREATED_AT, self::UPDATED_AT, 'deleted_at', 'installed_at']; public static array $validationRules = [ - 'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers', + 'external_id' => 'sometimes|nullable|string|between:1,255|unique:servers', 'owner_id' => 'required|integer|exists:users,id', - 'name' => 'required|string|min:1|max:191', + 'name' => 'required|string|min:1|max:255', 'node_id' => 'required|exists:nodes,id', 'description' => 'string', 'status' => 'nullable|string', @@ -156,7 +156,7 @@ class Server extends Model 'egg_id' => 'required|exists:eggs,id', 'startup' => 'required|string', 'skip_scripts' => 'sometimes|boolean', - 'image' => 'required|string|max:191', + 'image' => 'required|string|max:255', 'database_limit' => 'present|nullable|integer|min:0', 'allocation_limit' => 'sometimes|nullable|integer|min:0', 'backup_limit' => 'present|nullable|integer|min:0', diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 4d4087f7c..d25bd1b5d 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -21,7 +21,7 @@ class Setting extends Model protected $fillable = ['key', 'value']; public static array $validationRules = [ - 'key' => 'required|string|between:1,191', + 'key' => 'required|string|between:1,255', 'value' => 'string', ]; diff --git a/app/Models/User.php b/app/Models/User.php index ef9084d82..ebe905a6f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -155,11 +155,11 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac */ public static array $validationRules = [ 'uuid' => 'nullable|string|size:36|unique:users,uuid', - 'email' => 'required|email|between:1,191|unique:users,email', - 'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id', - 'username' => 'required|between:1,191|unique:users,username', - 'name_first' => 'nullable|string|between:0,191', - 'name_last' => 'nullable|string|between:0,191', + 'email' => 'required|email|between:1,255|unique:users,email', + 'external_id' => 'sometimes|nullable|string|max:255|unique:users,external_id', + 'username' => 'required|between:1,255|unique:users,username', + 'name_first' => 'nullable|string|between:0,255', + 'name_last' => 'nullable|string|between:0,255', 'password' => 'sometimes|nullable|string', 'root_admin' => 'boolean', 'language' => 'string', diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index c2473e87d..7d5ba0c44 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -16,7 +16,6 @@ use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Http; -use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; @@ -30,8 +29,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - Schema::defaultStringLength(191); - $versionData = app(SoftwareVersionService::class)->versionData(); View::share('appVersion', $versionData['version'] ?? 'undefined'); View::share('appIsGit', $versionData['is_git'] ?? false); diff --git a/database/migrations/2024_06_11_220722_update_field_length.php b/database/migrations/2024_06_11_220722_update_field_length.php new file mode 100644 index 000000000..ef6c9367a --- /dev/null +++ b/database/migrations/2024_06_11_220722_update_field_length.php @@ -0,0 +1,289 @@ +string('subject_type')->change(); + }); + + Schema::table('activity_logs', function (Blueprint $table) { + $table->string('event')->change(); + $table->string('ip')->change(); + $table->string('actor_type')->nullable()->default(null)->change(); + }); + + Schema::table('allocations', function (Blueprint $table) { + $table->string('ip')->change(); + $table->string('notes')->nullable()->default(null)->change(); + }); + + Schema::table('audit_logs', function (Blueprint $table) { + $table->string('action')->change(); + $table->string('subaction')->nullable()->default(null)->change(); + }); + + Schema::table('backups', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('disk')->change(); + $table->string('checksum')->nullable()->default(null)->change(); + }); + + Schema::table('database_hosts', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('host')->change(); + $table->string('username')->change(); + }); + + Schema::table('databases', function (Blueprint $table) { + $table->string('database')->change(); + $table->string('username')->change(); + $table->string('remote')->default('%')->change(); + }); + + Schema::table('egg_variables', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('env_variable')->change(); + }); + + Schema::table('eggs', function (Blueprint $table) { + $table->string('author')->change(); + $table->string('name')->change(); + $table->string('config_stop')->nullable()->default(null)->change(); + $table->string('script_container')->default('alpine:3.4')->change(); + $table->string('script_entry')->default('ash')->change(); + }); + + Schema::table('failed_jobs', function (Blueprint $table) { + $table->string('uuid')->nullable()->default(null)->change(); + }); + + Schema::table('jobs', function (Blueprint $table) { + $table->string('queue')->change(); + }); + + Schema::table('migrations', function (Blueprint $table) { + $table->string('migration')->change(); + }); + + Schema::table('mounts', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('source')->change(); + $table->string('target')->change(); + }); + + Schema::table('nodes', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('fqdn')->change(); + $table->string('scheme')->default('https')->change(); + $table->string('daemon_sftp_alias')->nullable()->default(null)->change(); + $table->string('daemon_base')->change(); + }); + + Schema::table('notifications', function (Blueprint $table) { + $table->string('id')->change(); + $table->string('type')->change(); + $table->string('notifiable_type')->change(); + }); + + Schema::table('password_resets', function (Blueprint $table) { + $table->string('email')->change(); + $table->string('token')->change(); + }); + + Schema::table('recovery_tokens', function (Blueprint $table) { + $table->string('token')->change(); + }); + + Schema::table('schedules', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('cron_day_of_week')->change(); + $table->string('cron_month')->change(); + $table->string('cron_day_of_month')->change(); + $table->string('cron_hour')->change(); + $table->string('cron_minute')->change(); + }); + + Schema::table('servers', function (Blueprint $table) { + $table->string('external_id')->nullable()->default(null)->change(); + $table->string('name')->change(); + $table->string('status')->nullable()->default(null)->change(); + $table->string('threads')->nullable()->default(null)->change(); + $table->string('image')->change(); + }); + + Schema::table('sessions', function (Blueprint $table) { + $table->string('id')->change(); + }); + + Schema::table('settings', function (Blueprint $table) { + $table->string('key')->change(); + }); + + Schema::table('tasks', function (Blueprint $table) { + $table->string('action')->change(); + }); + + Schema::table('user_ssh_keys', function (Blueprint $table) { + $table->string('name')->change(); + $table->string('fingerprint')->change(); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('external_id')->nullable()->default(null)->change(); + $table->string('username')->change(); + $table->string('email')->change(); + $table->string('name_first')->nullable()->default(null)->change(); + $table->string('name_last')->nullable()->default(null)->change(); + $table->string('remember_token')->nullable()->default(null)->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('activity_log_subjects', function (Blueprint $table) { + $table->string('subject_type', 191)->change(); + }); + + Schema::table('activity_logs', function (Blueprint $table) { + $table->string('event', 191)->change(); + $table->string('ip', 191)->change(); + $table->string('actor_type', 191)->nullable()->default(null)->change(); + }); + + Schema::table('allocations', function (Blueprint $table) { + $table->string('ip', 191)->change(); + $table->string('notes', 191)->nullable()->default(null)->change(); + }); + + Schema::table('audit_logs', function (Blueprint $table) { + $table->string('action', 191)->change(); + $table->string('subaction', 191)->nullable()->default(null)->change(); + }); + + Schema::table('backups', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('disk', 191)->change(); + $table->string('checksum', 191)->nullable()->default(null)->change(); + }); + Schema::table('database_hosts', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('host', 191)->change(); + $table->string('username', 191)->change(); + }); + + Schema::table('databases', function (Blueprint $table) { + $table->string('database', 191)->change(); + $table->string('username', 191)->change(); + $table->string('remote', 191)->default('%', 191)->change(); + }); + + Schema::table('egg_variables', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('env_variable', 191)->change(); + }); + + Schema::table('eggs', function (Blueprint $table) { + $table->string('author', 191)->change(); + $table->string('name', 191)->change(); + $table->string('config_stop', 191)->nullable()->default(null)->change(); + $table->string('script_container', 191)->default('alpine:3.4', 191)->change(); + $table->string('script_entry', 191)->default('ash', 191)->change(); + }); + + Schema::table('failed_jobs', function (Blueprint $table) { + $table->string('uuid', 191)->nullable()->default(null)->change(); + }); + + Schema::table('jobs', function (Blueprint $table) { + $table->string('queue', 191)->change(); + }); + + Schema::table('migrations', function (Blueprint $table) { + $table->string('migration', 191)->change(); + }); + + Schema::table('mounts', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('source', 191)->change(); + $table->string('target', 191)->change(); + }); + + Schema::table('nodes', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('fqdn', 191)->change(); + $table->string('scheme', 191)->default('https', 191)->change(); + $table->string('daemon_sftp_alias', 191)->nullable()->default(null)->change(); + $table->string('daemon_base', 191)->change(); + }); + + Schema::table('notifications', function (Blueprint $table) { + $table->string('id', 191)->change(); + $table->string('type', 191)->change(); + $table->string('notifiable_type', 191)->change(); + }); + + Schema::table('password_resets', function (Blueprint $table) { + $table->string('email', 191)->change(); + $table->string('token', 191)->change(); + }); + + Schema::table('recovery_tokens', function (Blueprint $table) { + $table->string('token', 191)->change(); + }); + + Schema::table('schedules', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('cron_day_of_week', 191)->change(); + $table->string('cron_month', 191)->change(); + $table->string('cron_day_of_month', 191)->change(); + $table->string('cron_hour', 191)->change(); + $table->string('cron_minute', 191)->change(); + }); + + Schema::table('servers', function (Blueprint $table) { + $table->string('external_id', 191)->nullable()->default(null)->change(); + $table->string('name', 191)->change(); + $table->string('status', 191)->nullable()->default(null)->change(); + $table->string('threads', 191)->nullable()->default(null)->change(); + $table->string('image', 191)->change(); + }); + + Schema::table('sessions', function (Blueprint $table) { + $table->string('id', 191)->change(); + }); + + Schema::table('settings', function (Blueprint $table) { + $table->string('key', 191)->change(); + }); + + Schema::table('tasks', function (Blueprint $table) { + $table->string('action', 191)->change(); + }); + + Schema::table('user_ssh_keys', function (Blueprint $table) { + $table->string('name', 191)->change(); + $table->string('fingerprint', 191)->change(); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('external_id', 191)->nullable()->default(null)->change(); + $table->string('username', 191)->change(); + $table->string('email', 191)->change(); + $table->string('name_first', 191)->nullable()->default(null)->change(); + $table->string('name_last', 191)->nullable()->default(null)->change(); + $table->string('remember_token', 191)->nullable()->default(null)->change(); + }); + } +}; diff --git a/database/schema/mysql-schema.sql b/database/schema/mysql-schema.sql index 2d7e5ff8d..79d454839 100644 --- a/database/schema/mysql-schema.sql +++ b/database/schema/mysql-schema.sql @@ -8,637 +8,640 @@ DROP TABLE IF EXISTS `activity_log_subjects`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `activity_log_subjects` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `activity_log_id` bigint unsigned NOT NULL, - `subject_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `subject_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `activity_log_subjects_activity_log_id_foreign` (`activity_log_id`), - KEY `activity_log_subjects_subject_type_subject_id_index` (`subject_type`,`subject_id`), - CONSTRAINT `activity_log_subjects_activity_log_id_foreign` FOREIGN KEY (`activity_log_id`) REFERENCES `activity_logs` (`id`) ON DELETE CASCADE + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `activity_log_id` bigint unsigned NOT NULL, + `subject_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `subject_id` bigint unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `activity_log_subjects_activity_log_id_foreign` (`activity_log_id`), + KEY `activity_log_subjects_subject_type_subject_id_index` (`subject_type`,`subject_id`), + CONSTRAINT `activity_log_subjects_activity_log_id_foreign` FOREIGN KEY (`activity_log_id`) REFERENCES `activity_logs` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `activity_logs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `activity_logs` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `batch` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `event` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text COLLATE utf8mb4_unicode_ci, - `actor_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `actor_id` bigint unsigned DEFAULT NULL, - `api_key_id` int unsigned DEFAULT NULL, - `properties` json NOT NULL, - `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `activity_logs_actor_type_actor_id_index` (`actor_type`,`actor_id`), - KEY `activity_logs_event_index` (`event`) + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `batch` char(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `event` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `ip` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci, + `actor_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `actor_id` bigint unsigned DEFAULT NULL, + `api_key_id` int unsigned DEFAULT NULL, + `properties` json NOT NULL, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `activity_logs_actor_type_actor_id_index` (`actor_type`,`actor_id`), + KEY `activity_logs_event_index` (`event`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `allocations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `allocations` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `node_id` int unsigned NOT NULL, - `ip` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `ip_alias` text COLLATE utf8mb4_unicode_ci, - `port` mediumint unsigned NOT NULL, - `server_id` int unsigned DEFAULT NULL, - `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `allocations_node_id_ip_port_unique` (`node_id`,`ip`,`port`), - KEY `allocations_server_id_foreign` (`server_id`), - CONSTRAINT `allocations_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE CASCADE, - CONSTRAINT `allocations_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE SET NULL + `id` int unsigned NOT NULL AUTO_INCREMENT, + `node_id` int unsigned NOT NULL, + `ip` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `ip_alias` text COLLATE utf8mb4_unicode_ci, + `port` mediumint unsigned NOT NULL, + `server_id` int unsigned DEFAULT NULL, + `notes` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `allocations_node_id_ip_port_unique` (`node_id`,`ip`,`port`), + KEY `allocations_server_id_foreign` (`server_id`), + CONSTRAINT `allocations_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE CASCADE, + CONSTRAINT `allocations_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `api_keys`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `api_keys` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `user_id` int unsigned NOT NULL, - `key_type` tinyint unsigned NOT NULL DEFAULT '0', - `identifier` char(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `allowed_ips` text COLLATE utf8mb4_unicode_ci, - `memo` text COLLATE utf8mb4_unicode_ci, - `last_used_at` timestamp NULL DEFAULT NULL, - `expires_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `r_servers` tinyint unsigned NOT NULL DEFAULT '0', - `r_nodes` tinyint unsigned NOT NULL DEFAULT '0', - `r_allocations` tinyint unsigned NOT NULL DEFAULT '0', - `r_users` tinyint unsigned NOT NULL DEFAULT '0', - `r_eggs` tinyint unsigned NOT NULL DEFAULT '0', - `r_database_hosts` tinyint unsigned NOT NULL DEFAULT '0', - `r_server_databases` tinyint unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `api_keys_identifier_unique` (`identifier`), - KEY `api_keys_user_id_foreign` (`user_id`), - CONSTRAINT `api_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned NOT NULL, + `key_type` tinyint unsigned NOT NULL DEFAULT '0', + `identifier` char(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `public` char(16) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` text COLLATE utf8mb4_unicode_ci NOT NULL, + `allowed_ips` text COLLATE utf8mb4_unicode_ci, + `memo` text COLLATE utf8mb4_unicode_ci, + `last_used_at` timestamp NULL DEFAULT NULL, + `expires_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `r_servers` tinyint unsigned NOT NULL DEFAULT '0', + `r_nodes` tinyint unsigned NOT NULL DEFAULT '0', + `r_allocations` tinyint unsigned NOT NULL DEFAULT '0', + `r_users` tinyint unsigned NOT NULL DEFAULT '0', + `r_eggs` tinyint unsigned NOT NULL DEFAULT '0', + `r_database_hosts` tinyint unsigned NOT NULL DEFAULT '0', + `r_server_databases` tinyint unsigned NOT NULL DEFAULT '0', + `r_mounts` tinyint unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `api_keys_identifier_unique` (`identifier`), + KEY `api_keys_user_id_foreign` (`user_id`), + CONSTRAINT `api_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `api_logs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `api_logs` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `authorized` tinyint(1) NOT NULL, - `error` text COLLATE utf8mb4_unicode_ci, - `key` char(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `method` char(6) COLLATE utf8mb4_unicode_ci NOT NULL, - `route` text COLLATE utf8mb4_unicode_ci NOT NULL, - `content` text COLLATE utf8mb4_unicode_ci, - `user_agent` text COLLATE utf8mb4_unicode_ci NOT NULL, - `request_ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `authorized` tinyint(1) NOT NULL, + `error` text COLLATE utf8mb4_unicode_ci, + `key` char(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `method` char(6) COLLATE utf8mb4_unicode_ci NOT NULL, + `route` text COLLATE utf8mb4_unicode_ci NOT NULL, + `content` text COLLATE utf8mb4_unicode_ci, + `user_agent` text COLLATE utf8mb4_unicode_ci NOT NULL, + `request_ip` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `audit_logs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `audit_logs` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `is_system` tinyint(1) NOT NULL DEFAULT '0', - `user_id` int unsigned DEFAULT NULL, - `server_id` int unsigned DEFAULT NULL, - `action` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `subaction` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `device` json NOT NULL, - `metadata` json NOT NULL, - `created_at` timestamp NOT NULL, - PRIMARY KEY (`id`), - KEY `audit_logs_user_id_foreign` (`user_id`), - KEY `audit_logs_server_id_foreign` (`server_id`), - KEY `audit_logs_action_server_id_index` (`action`,`server_id`), - CONSTRAINT `audit_logs_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, - CONSTRAINT `audit_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_system` tinyint(1) NOT NULL DEFAULT '0', + `user_id` int unsigned DEFAULT NULL, + `server_id` int unsigned DEFAULT NULL, + `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `subaction` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `device` json NOT NULL, + `metadata` json NOT NULL, + `created_at` timestamp NOT NULL, + PRIMARY KEY (`id`), + KEY `audit_logs_user_id_foreign` (`user_id`), + KEY `audit_logs_server_id_foreign` (`server_id`), + KEY `audit_logs_action_server_id_index` (`action`,`server_id`), + CONSTRAINT `audit_logs_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, + CONSTRAINT `audit_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `backups`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `backups` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `server_id` int unsigned NOT NULL, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `upload_id` text COLLATE utf8mb4_unicode_ci, - `is_successful` tinyint(1) NOT NULL DEFAULT '0', - `is_locked` tinyint unsigned NOT NULL DEFAULT '0', - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `ignored_files` text COLLATE utf8mb4_unicode_ci NOT NULL, - `disk` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `checksum` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `bytes` bigint unsigned NOT NULL DEFAULT '0', - `completed_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `backups_uuid_unique` (`uuid`), - KEY `backups_server_id_foreign` (`server_id`), - CONSTRAINT `backups_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `server_id` int unsigned NOT NULL, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_successful` tinyint(1) NOT NULL DEFAULT '0', + `upload_id` text COLLATE utf8mb4_unicode_ci, + `is_locked` tinyint unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `ignored_files` text COLLATE utf8mb4_unicode_ci NOT NULL, + `disk` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `checksum` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bytes` bigint unsigned NOT NULL DEFAULT '0', + `completed_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `backups_uuid_unique` (`uuid`), + KEY `backups_server_id_foreign` (`server_id`), + CONSTRAINT `backups_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `database_hosts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `database_hosts` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `host` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `port` int unsigned NOT NULL, - `username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `password` text COLLATE utf8mb4_unicode_ci NOT NULL, - `max_databases` int unsigned DEFAULT NULL, - `node_id` int unsigned DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `database_hosts_node_id_foreign` (`node_id`), - CONSTRAINT `database_hosts_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE SET NULL + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `host` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `port` int unsigned NOT NULL, + `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `password` text COLLATE utf8mb4_unicode_ci NOT NULL, + `max_databases` int unsigned DEFAULT NULL, + `node_id` int unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `database_hosts_node_id_foreign` (`node_id`), + CONSTRAINT `database_hosts_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `databases`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `databases` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `server_id` int unsigned NOT NULL, - `database_host_id` int unsigned NOT NULL, - `database` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `remote` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '%', - `password` text COLLATE utf8mb4_unicode_ci NOT NULL, - `max_connections` int DEFAULT '0', - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `databases_database_host_id_username_unique` (`database_host_id`,`username`), - UNIQUE KEY `databases_database_host_id_server_id_database_unique` (`database_host_id`,`server_id`,`database`), - KEY `databases_server_id_foreign` (`server_id`), - CONSTRAINT `databases_database_host_id_foreign` FOREIGN KEY (`database_host_id`) REFERENCES `database_hosts` (`id`), - CONSTRAINT `databases_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `server_id` int unsigned NOT NULL, + `database_host_id` int unsigned NOT NULL, + `database` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `remote` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '%', + `password` text COLLATE utf8mb4_unicode_ci NOT NULL, + `max_connections` int DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `databases_database_host_id_username_unique` (`database_host_id`,`username`), + UNIQUE KEY `databases_database_host_id_server_id_database_unique` (`database_host_id`,`server_id`,`database`), + KEY `databases_server_id_foreign` (`server_id`), + CONSTRAINT `databases_database_host_id_foreign` FOREIGN KEY (`database_host_id`) REFERENCES `database_hosts` (`id`), + CONSTRAINT `databases_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `egg_mount`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `egg_mount` ( - `egg_id` int unsigned NOT NULL, - `mount_id` int unsigned NOT NULL, - UNIQUE KEY `egg_mount_egg_id_mount_id_unique` (`egg_id`,`mount_id`), - KEY `egg_mount_mount_id_foreign` (`mount_id`), - CONSTRAINT `egg_mount_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `egg_mount_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + `egg_id` int unsigned NOT NULL, + `mount_id` int unsigned NOT NULL, + UNIQUE KEY `egg_mount_egg_id_mount_id_unique` (`egg_id`,`mount_id`), + KEY `egg_mount_mount_id_foreign` (`mount_id`), + CONSTRAINT `egg_mount_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `egg_mount_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `egg_variables`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `egg_variables` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `egg_id` int unsigned NOT NULL, - `sort` tinyint unsigned DEFAULT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text COLLATE utf8mb4_unicode_ci NOT NULL, - `env_variable` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `default_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `user_viewable` tinyint unsigned NOT NULL, - `user_editable` tinyint unsigned NOT NULL, - `rules` text COLLATE utf8mb4_unicode_ci, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `service_variables_egg_id_foreign` (`egg_id`), - CONSTRAINT `service_variables_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `egg_id` int unsigned NOT NULL, + `sort` tinyint unsigned DEFAULT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci NOT NULL, + `env_variable` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `default_value` text COLLATE utf8mb4_unicode_ci NOT NULL, + `user_viewable` tinyint unsigned NOT NULL, + `user_editable` tinyint unsigned NOT NULL, + `rules` text COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `service_variables_egg_id_foreign` (`egg_id`), + CONSTRAINT `service_variables_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `eggs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `eggs` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `author` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `features` json DEFAULT NULL, - `docker_images` json DEFAULT NULL, - `file_denylist` json DEFAULT NULL, - `update_url` text COLLATE utf8mb4_unicode_ci, - `config_files` text COLLATE utf8mb4_unicode_ci, - `config_startup` text COLLATE utf8mb4_unicode_ci, - `config_logs` text COLLATE utf8mb4_unicode_ci, - `config_stop` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `config_from` int unsigned DEFAULT NULL, - `startup` text COLLATE utf8mb4_unicode_ci, - `script_container` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'alpine:3.4', - `copy_script_from` int unsigned DEFAULT NULL, - `script_entry` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ash', - `script_is_privileged` tinyint(1) NOT NULL DEFAULT '1', - `script_install` text COLLATE utf8mb4_unicode_ci, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `force_outgoing_ip` tinyint(1) NOT NULL DEFAULT '0', - `tags` text COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `service_options_uuid_unique` (`uuid`), - KEY `eggs_config_from_foreign` (`config_from`), - KEY `eggs_copy_script_from_foreign` (`copy_script_from`), - CONSTRAINT `eggs_config_from_foreign` FOREIGN KEY (`config_from`) REFERENCES `eggs` (`id`) ON DELETE SET NULL, - CONSTRAINT `eggs_copy_script_from_foreign` FOREIGN KEY (`copy_script_from`) REFERENCES `eggs` (`id`) ON DELETE SET NULL + `id` int unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `author` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci, + `features` json DEFAULT NULL, + `docker_images` json DEFAULT NULL, + `file_denylist` json DEFAULT NULL, + `update_url` text COLLATE utf8mb4_unicode_ci, + `config_files` text COLLATE utf8mb4_unicode_ci, + `config_startup` text COLLATE utf8mb4_unicode_ci, + `config_logs` text COLLATE utf8mb4_unicode_ci, + `config_stop` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `config_from` int unsigned DEFAULT NULL, + `startup` text COLLATE utf8mb4_unicode_ci, + `script_container` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'alpine:3.4', + `copy_script_from` int unsigned DEFAULT NULL, + `script_entry` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ash', + `script_is_privileged` tinyint(1) NOT NULL DEFAULT '1', + `script_install` text COLLATE utf8mb4_unicode_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `force_outgoing_ip` tinyint(1) NOT NULL DEFAULT '0', + `tags` text COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `service_options_uuid_unique` (`uuid`), + KEY `eggs_config_from_foreign` (`config_from`), + KEY `eggs_copy_script_from_foreign` (`copy_script_from`), + CONSTRAINT `eggs_config_from_foreign` FOREIGN KEY (`config_from`) REFERENCES `eggs` (`id`) ON DELETE SET NULL, + CONSTRAINT `eggs_copy_script_from_foreign` FOREIGN KEY (`copy_script_from`) REFERENCES `eggs` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `failed_jobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `failed_jobs` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, - `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, - `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, - `failed_at` timestamp NOT NULL, - `exception` text COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `connection` text COLLATE utf8mb4_unicode_ci NOT NULL, + `queue` text COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `failed_at` timestamp NOT NULL, + `exception` text COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `jobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `jobs` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `queue` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, - `attempts` tinyint unsigned NOT NULL, - `reserved_at` int unsigned DEFAULT NULL, - `available_at` int unsigned NOT NULL, - `created_at` int unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `jobs_queue_reserved_at_index` (`queue`,`reserved_at`) + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `attempts` tinyint unsigned NOT NULL, + `reserved_at` int unsigned DEFAULT NULL, + `available_at` int unsigned NOT NULL, + `created_at` int unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `jobs_queue_reserved_at_index` (`queue`,`reserved_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `migrations` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `batch` int NOT NULL, - PRIMARY KEY (`id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `batch` int NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `mount_node`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mount_node` ( - `node_id` int unsigned NOT NULL, - `mount_id` int unsigned NOT NULL, - UNIQUE KEY `mount_node_node_id_mount_id_unique` (`node_id`,`mount_id`), - KEY `mount_node_mount_id_foreign` (`mount_id`), - CONSTRAINT `mount_node_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mount_node_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + `node_id` int unsigned NOT NULL, + `mount_id` int unsigned NOT NULL, + UNIQUE KEY `mount_node_node_id_mount_id_unique` (`node_id`,`mount_id`), + KEY `mount_node_mount_id_foreign` (`mount_id`), + CONSTRAINT `mount_node_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `mount_node_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `mount_server`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mount_server` ( - `server_id` int unsigned NOT NULL, - `mount_id` int unsigned NOT NULL, - UNIQUE KEY `mount_server_server_id_mount_id_unique` (`server_id`,`mount_id`), - KEY `mount_server_mount_id_foreign` (`mount_id`), - CONSTRAINT `mount_server_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mount_server_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + `server_id` int unsigned NOT NULL, + `mount_id` int unsigned NOT NULL, + UNIQUE KEY `mount_server_server_id_mount_id_unique` (`server_id`,`mount_id`), + KEY `mount_server_mount_id_foreign` (`mount_id`), + CONSTRAINT `mount_server_mount_id_foreign` FOREIGN KEY (`mount_id`) REFERENCES `mounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `mount_server_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `mounts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `mounts` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text COLLATE utf8mb4_unicode_ci, - `source` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `target` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `read_only` tinyint unsigned NOT NULL, - `user_mountable` tinyint unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `mounts_id_unique` (`id`), - UNIQUE KEY `mounts_uuid_unique` (`uuid`), - UNIQUE KEY `mounts_name_unique` (`name`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci, + `source` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `target` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `read_only` tinyint unsigned NOT NULL, + `user_mountable` tinyint unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `mounts_id_unique` (`id`), + UNIQUE KEY `mounts_uuid_unique` (`uuid`), + UNIQUE KEY `mounts_name_unique` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `nodes`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `nodes` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `public` smallint unsigned NOT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `fqdn` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `scheme` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'https', - `behind_proxy` tinyint(1) NOT NULL DEFAULT '0', - `maintenance_mode` tinyint(1) NOT NULL DEFAULT '0', - `memory` int unsigned NOT NULL, - `memory_overallocate` int NOT NULL DEFAULT '0', - `disk` int unsigned NOT NULL, - `disk_overallocate` int NOT NULL DEFAULT '0', - `cpu` int unsigned NOT NULL DEFAULT '0', - `cpu_overallocate` int NOT NULL DEFAULT '0', - `upload_size` int unsigned NOT NULL DEFAULT '100', - `daemon_token_id` char(16) COLLATE utf8mb4_unicode_ci NOT NULL, - `daemon_token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `daemon_listen` smallint unsigned NOT NULL DEFAULT '8080', - `daemon_sftp` smallint unsigned NOT NULL DEFAULT '2022', - `daemon_base` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `tags` text COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `nodes_uuid_unique` (`uuid`), - UNIQUE KEY `nodes_daemon_token_id_unique` (`daemon_token_id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `public` smallint unsigned NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci, + `fqdn` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `scheme` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'https', + `behind_proxy` tinyint(1) NOT NULL DEFAULT '0', + `maintenance_mode` tinyint(1) NOT NULL DEFAULT '0', + `memory` int unsigned NOT NULL, + `memory_overallocate` int NOT NULL DEFAULT '0', + `disk` int unsigned NOT NULL, + `disk_overallocate` int NOT NULL DEFAULT '0', + `cpu` int unsigned NOT NULL DEFAULT '0', + `cpu_overallocate` int NOT NULL DEFAULT '0', + `upload_size` int unsigned NOT NULL DEFAULT '100', + `daemon_token_id` char(16) COLLATE utf8mb4_unicode_ci NOT NULL, + `daemon_token` text COLLATE utf8mb4_unicode_ci NOT NULL, + `daemon_listen` smallint unsigned NOT NULL DEFAULT '8080', + `daemon_sftp` smallint unsigned NOT NULL DEFAULT '2022', + `daemon_sftp_alias` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `daemon_base` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `tags` text COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `nodes_uuid_unique` (`uuid`), + UNIQUE KEY `nodes_daemon_token_id_unique` (`daemon_token_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `notifications`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `notifications` ( - `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `notifiable_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `notifiable_id` bigint unsigned NOT NULL, - `data` text COLLATE utf8mb4_unicode_ci NOT NULL, - `read_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`) + `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `notifiable_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `notifiable_id` bigint unsigned NOT NULL, + `data` text COLLATE utf8mb4_unicode_ci NOT NULL, + `read_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `password_resets` ( - `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL, - KEY `password_resets_email_index` (`email`), - KEY `password_resets_token_index` (`token`) + `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL, + KEY `password_resets_email_index` (`email`), + KEY `password_resets_token_index` (`token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `recovery_tokens`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `recovery_tokens` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT, - `user_id` int unsigned NOT NULL, - `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `recovery_tokens_user_id_foreign` (`user_id`), - CONSTRAINT `recovery_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned NOT NULL, + `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `recovery_tokens_user_id_foreign` (`user_id`), + CONSTRAINT `recovery_tokens_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `schedules`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `schedules` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `server_id` int unsigned NOT NULL, - `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_day_of_week` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_month` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_day_of_month` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_hour` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `cron_minute` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `is_active` tinyint(1) NOT NULL, - `is_processing` tinyint(1) NOT NULL, - `only_when_online` tinyint unsigned NOT NULL DEFAULT '0', - `last_run_at` timestamp NULL DEFAULT NULL, - `next_run_at` timestamp NULL DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `schedules_server_id_foreign` (`server_id`), - CONSTRAINT `schedules_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `server_id` int unsigned NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `cron_day_of_week` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `cron_month` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `cron_day_of_month` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `cron_hour` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `cron_minute` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `is_active` tinyint(1) NOT NULL, + `is_processing` tinyint(1) NOT NULL, + `only_when_online` tinyint unsigned NOT NULL DEFAULT '0', + `last_run_at` timestamp NULL DEFAULT NULL, + `next_run_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `schedules_server_id_foreign` (`server_id`), + CONSTRAINT `schedules_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `server_transfers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `server_transfers` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `server_id` int unsigned NOT NULL, - `successful` tinyint(1) DEFAULT NULL, - `old_node` int unsigned NOT NULL, - `new_node` int unsigned NOT NULL, - `old_allocation` int unsigned NOT NULL, - `new_allocation` int unsigned NOT NULL, - `old_additional_allocations` json DEFAULT NULL, - `new_additional_allocations` json DEFAULT NULL, - `archived` tinyint(1) NOT NULL DEFAULT '0', - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `server_transfers_server_id_foreign` (`server_id`), - CONSTRAINT `server_transfers_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `server_id` int unsigned NOT NULL, + `successful` tinyint(1) DEFAULT NULL, + `old_node` int unsigned NOT NULL, + `new_node` int unsigned NOT NULL, + `old_allocation` int unsigned NOT NULL, + `new_allocation` int unsigned NOT NULL, + `old_additional_allocations` json DEFAULT NULL, + `new_additional_allocations` json DEFAULT NULL, + `archived` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `server_transfers_server_id_foreign` (`server_id`), + CONSTRAINT `server_transfers_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `server_variables`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `server_variables` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `server_id` int unsigned DEFAULT NULL, - `variable_id` int unsigned NOT NULL, - `variable_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `server_variables_server_id_foreign` (`server_id`), - KEY `server_variables_variable_id_foreign` (`variable_id`), - CONSTRAINT `server_variables_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, - CONSTRAINT `server_variables_variable_id_foreign` FOREIGN KEY (`variable_id`) REFERENCES `egg_variables` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `server_id` int unsigned NOT NULL, + `variable_id` int unsigned NOT NULL, + `variable_value` text COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `server_variables_server_id_foreign` (`server_id`), + KEY `server_variables_variable_id_foreign` (`variable_id`), + CONSTRAINT `server_variables_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, + CONSTRAINT `server_variables_variable_id_foreign` FOREIGN KEY (`variable_id`) REFERENCES `egg_variables` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `servers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `servers` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `external_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `uuid_short` char(8) COLLATE utf8mb4_unicode_ci NOT NULL, - `node_id` int unsigned NOT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `description` text COLLATE utf8mb4_unicode_ci NOT NULL, - `status` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `skip_scripts` tinyint(1) NOT NULL DEFAULT '0', - `owner_id` int unsigned NOT NULL, - `memory` int unsigned NOT NULL, - `swap` int NOT NULL, - `disk` int unsigned NOT NULL, - `io` int unsigned NOT NULL, - `cpu` int unsigned NOT NULL, - `threads` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `oom_killer` tinyint unsigned NOT NULL DEFAULT '0', - `allocation_id` int unsigned NOT NULL, - `egg_id` int unsigned NOT NULL, - `startup` text COLLATE utf8mb4_unicode_ci NOT NULL, - `image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `allocation_limit` int unsigned DEFAULT NULL, - `database_limit` int unsigned DEFAULT '0', - `backup_limit` int unsigned NOT NULL DEFAULT '0', - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `installed_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `servers_uuid_unique` (`uuid`), - UNIQUE KEY `servers_uuidshort_unique` (`uuid_short`), - UNIQUE KEY `servers_allocation_id_unique` (`allocation_id`), - UNIQUE KEY `servers_external_id_unique` (`external_id`), - KEY `servers_node_id_foreign` (`node_id`), - KEY `servers_owner_id_foreign` (`owner_id`), - KEY `servers_egg_id_foreign` (`egg_id`), - CONSTRAINT `servers_allocation_id_foreign` FOREIGN KEY (`allocation_id`) REFERENCES `allocations` (`id`), - CONSTRAINT `servers_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`), - CONSTRAINT `servers_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`), - CONSTRAINT `servers_owner_id_foreign` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `external_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `uuid_short` char(8) COLLATE utf8mb4_unicode_ci NOT NULL, + `node_id` int unsigned NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `description` text COLLATE utf8mb4_unicode_ci NOT NULL, + `status` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `skip_scripts` tinyint(1) NOT NULL DEFAULT '0', + `owner_id` int unsigned NOT NULL, + `memory` int unsigned NOT NULL, + `swap` int NOT NULL, + `disk` int unsigned NOT NULL, + `io` int unsigned NOT NULL, + `cpu` int unsigned NOT NULL, + `threads` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `oom_killer` tinyint unsigned NOT NULL DEFAULT '0', + `allocation_id` int unsigned NOT NULL, + `egg_id` int unsigned NOT NULL, + `startup` text COLLATE utf8mb4_unicode_ci NOT NULL, + `image` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `allocation_limit` int unsigned DEFAULT NULL, + `database_limit` int unsigned DEFAULT '0', + `backup_limit` int unsigned NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `installed_at` timestamp NULL DEFAULT NULL, + `docker_labels` text COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `servers_uuid_unique` (`uuid`), + UNIQUE KEY `servers_uuidshort_unique` (`uuid_short`), + UNIQUE KEY `servers_allocation_id_unique` (`allocation_id`), + UNIQUE KEY `servers_external_id_unique` (`external_id`), + KEY `servers_node_id_foreign` (`node_id`), + KEY `servers_owner_id_foreign` (`owner_id`), + KEY `servers_egg_id_foreign` (`egg_id`), + CONSTRAINT `servers_allocation_id_foreign` FOREIGN KEY (`allocation_id`) REFERENCES `allocations` (`id`), + CONSTRAINT `servers_egg_id_foreign` FOREIGN KEY (`egg_id`) REFERENCES `eggs` (`id`), + CONSTRAINT `servers_node_id_foreign` FOREIGN KEY (`node_id`) REFERENCES `nodes` (`id`), + CONSTRAINT `servers_owner_id_foreign` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `sessions`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `sessions` ( - `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `user_id` int DEFAULT NULL, - `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `user_agent` text COLLATE utf8mb4_unicode_ci, - `payload` text COLLATE utf8mb4_unicode_ci NOT NULL, - `last_activity` int NOT NULL, - UNIQUE KEY `sessions_id_unique` (`id`) + `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `user_id` int DEFAULT NULL, + `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `user_agent` text COLLATE utf8mb4_unicode_ci, + `payload` text COLLATE utf8mb4_unicode_ci NOT NULL, + `last_activity` int NOT NULL, + UNIQUE KEY `sessions_id_unique` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `settings`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `settings` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `key` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `value` text COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `settings_key_unique` (`key`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `value` text COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `subusers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `subusers` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `user_id` int unsigned NOT NULL, - `server_id` int unsigned NOT NULL, - `permissions` json DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `subusers_user_id_foreign` (`user_id`), - KEY `subusers_server_id_foreign` (`server_id`), - CONSTRAINT `subusers_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, - CONSTRAINT `subusers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned NOT NULL, + `server_id` int unsigned NOT NULL, + `permissions` json DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `subusers_user_id_foreign` (`user_id`), + KEY `subusers_server_id_foreign` (`server_id`), + CONSTRAINT `subusers_server_id_foreign` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE, + CONSTRAINT `subusers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `tasks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `tasks` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `schedule_id` int unsigned NOT NULL, - `sequence_id` int unsigned NOT NULL, - `action` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `payload` text COLLATE utf8mb4_unicode_ci NOT NULL, - `time_offset` int unsigned NOT NULL, - `is_queued` tinyint(1) NOT NULL, - `continue_on_failure` tinyint unsigned NOT NULL DEFAULT '0', - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `tasks_schedule_id_sequence_id_index` (`schedule_id`,`sequence_id`), - CONSTRAINT `tasks_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `schedule_id` int unsigned NOT NULL, + `sequence_id` int unsigned NOT NULL, + `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` text COLLATE utf8mb4_unicode_ci NOT NULL, + `time_offset` int unsigned NOT NULL, + `is_queued` tinyint(1) NOT NULL, + `continue_on_failure` tinyint unsigned NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tasks_schedule_id_sequence_id_index` (`schedule_id`,`sequence_id`), + CONSTRAINT `tasks_schedule_id_foreign` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `tasks_log`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `tasks_log` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `task_id` int unsigned NOT NULL, - `run_time` timestamp NOT NULL, - `run_status` int unsigned NOT NULL, - `response` text COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `task_id` int unsigned NOT NULL, + `run_time` timestamp NOT NULL, + `run_status` int unsigned NOT NULL, + `response` text COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `user_ssh_keys`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `user_ssh_keys` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `user_id` int unsigned NOT NULL, - `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `fingerprint` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `public_key` text COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `deleted_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `user_ssh_keys_user_id_foreign` (`user_id`), - CONSTRAINT `user_ssh_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE + `id` int unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `fingerprint` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `public_key` text COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `user_ssh_keys_user_id_foreign` (`user_id`), + CONSTRAINT `user_ssh_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `users` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `external_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, - `username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, - `name_first` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `name_last` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `password` text COLLATE utf8mb4_unicode_ci NOT NULL, - `remember_token` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `language` char(5) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en', - `root_admin` tinyint unsigned NOT NULL DEFAULT '0', - `use_totp` tinyint unsigned NOT NULL, - `totp_secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `totp_authenticated_at` timestamp NULL DEFAULT NULL, - `gravatar` tinyint(1) NOT NULL DEFAULT '1', - `created_at` timestamp NULL DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `users_uuid_unique` (`uuid`), - UNIQUE KEY `users_email_unique` (`email`), - UNIQUE KEY `users_username_unique` (`username`), - KEY `users_external_id_index` (`external_id`) + `id` int unsigned NOT NULL AUTO_INCREMENT, + `external_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `uuid` char(36) COLLATE utf8mb4_unicode_ci NOT NULL, + `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `name_first` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name_last` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` text COLLATE utf8mb4_unicode_ci NOT NULL, + `remember_token` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `language` char(5) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en', + `root_admin` tinyint unsigned NOT NULL DEFAULT '0', + `use_totp` tinyint unsigned NOT NULL, + `totp_secret` text COLLATE utf8mb4_unicode_ci, + `totp_authenticated_at` timestamp NULL DEFAULT NULL, + `gravatar` tinyint(1) NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_uuid_unique` (`uuid`), + UNIQUE KEY `users_email_unique` (`email`), + UNIQUE KEY `users_username_unique` (`username`), + KEY `users_external_id_index` (`external_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -704,147 +707,153 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (53,'2016_10_23_204 INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (54,'2016_10_23_204321_add_foreign_service_variables',1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (55,'2016_10_23_204454_add_foreign_subusers',1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (56,'2016_10_23_204610_add_foreign_tasks',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2016_11_04_000949_add_ark_service_option_fixed',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2016_11_11_220649_add_pack_support',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (59,'2016_11_11_231731_set_service_name_unique',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (60,'2016_11_27_142519_add_pack_column',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (61,'2016_12_01_173018_add_configurable_upload_limit',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (62,'2016_12_02_185206_correct_service_variables',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (63,'2017_01_03_150436_fix_misnamed_option_tag',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (64,'2017_01_07_154228_create_node_configuration_tokens_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (65,'2017_01_12_135449_add_more_user_data',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (66,'2017_02_02_175548_UpdateColumnNames',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (67,'2017_02_03_140948_UpdateNodesTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (68,'2017_02_03_155554_RenameColumns',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (69,'2017_02_05_164123_AdjustColumnNames',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (70,'2017_02_05_164516_AdjustColumnNamesForServicePacks',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (71,'2017_02_09_174834_SetupPermissionsPivotTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (72,'2017_02_10_171858_UpdateAPIKeyColumnNames',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (73,'2017_03_03_224254_UpdateNodeConfigTokensColumns',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (74,'2017_03_05_212803_DeleteServiceExecutableOption',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (75,'2017_03_10_162934_AddNewServiceOptionsColumns',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (76,'2017_03_10_173607_MigrateToNewServiceSystem',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (77,'2017_03_11_215455_ChangeServiceVariablesValidationRules',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (78,'2017_03_12_150648_MoveFunctionsFromFileToDatabase',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (79,'2017_03_14_175631_RenameServicePacksToSingluarPacks',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (80,'2017_03_14_200326_AddLockedStatusToTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (81,'2017_03_16_181109_ReOrganizeDatabaseServersToDatabaseHost',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (82,'2017_03_16_181515_CleanupDatabasesDatabase',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (83,'2017_03_18_204953_AddForeignKeyToPacks',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (84,'2017_03_31_221948_AddServerDescriptionColumn',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (85,'2017_04_02_163232_DropDeletedAtColumnFromServers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (86,'2017_04_15_125021_UpgradeTaskSystem',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (87,'2017_04_20_171943_AddScriptsToServiceOptions',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (88,'2017_04_21_151432_AddServiceScriptTrackingToServers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (89,'2017_04_27_145300_AddCopyScriptFromColumn',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (90,'2017_04_27_223629_AddAbilityToDefineConnectionOverSSLWithDaemonBehindProxy',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (91,'2017_05_01_141528_DeleteDownloadTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (92,'2017_05_01_141559_DeleteNodeConfigurationTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (93,'2017_06_10_152951_add_external_id_to_users',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (94,'2017_06_25_133923_ChangeForeignKeyToBeOnCascadeDelete',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (95,'2017_07_08_152806_ChangeUserPermissionsToDeleteOnUserDeletion',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (96,'2017_07_08_154416_SetAllocationToReferenceNullOnServerDelete',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (97,'2017_07_08_154650_CascadeDeletionWhenAServerOrVariableIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (98,'2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (99,'2017_08_05_115800_CascadeNullValuesForDatabaseHostWhenNodeIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (100,'2017_08_05_144104_AllowNegativeValuesForOverallocation',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (101,'2017_08_05_174811_SetAllocationUnqiueUsingMultipleFields',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (102,'2017_08_15_214555_CascadeDeletionWhenAParentServiceIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (103,'2017_08_18_215428_RemovePackWhenParentServiceOptionIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (104,'2017_09_10_225749_RenameTasksTableForStructureRefactor',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (105,'2017_09_10_225941_CreateSchedulesTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (106,'2017_09_10_230309_CreateNewTasksTableForSchedules',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (107,'2017_09_11_002938_TransferOldTasksToNewScheduler',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (108,'2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (109,'2017_09_23_170933_CreateDaemonKeysTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (110,'2017_09_23_173628_RemoveDaemonSecretFromServersTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (111,'2017_09_23_185022_RemoveDaemonSecretFromSubusersTable',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (112,'2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (113,'2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (114,'2017_10_03_233202_CascadeDeletionWhenServiceOptionIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (115,'2017_10_06_214026_ServicesToNestsConversion',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (116,'2017_10_06_214053_ServiceOptionsToEggsConversion',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (117,'2017_10_06_215741_ServiceVariablesToEggVariablesConversion',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (118,'2017_10_24_222238_RemoveLegacySFTPInformation',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (119,'2017_11_11_161922_Add2FaLastAuthorizationTimeColumn',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (120,'2017_11_19_122708_MigratePubPrivFormatToSingleKey',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (121,'2017_12_04_184012_DropAllocationsWhenNodeIsDeleted',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (122,'2017_12_12_220426_MigrateSettingsTableToNewFormat',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (123,'2018_01_01_122821_AllowNegativeValuesForServerSwap',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (124,'2018_01_11_213943_AddApiKeyPermissionColumns',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (125,'2018_01_13_142012_SetupTableForKeyEncryption',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (126,'2018_01_13_145209_AddLastUsedAtColumn',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (127,'2018_02_04_145617_AllowTextInUserExternalId',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (128,'2018_02_10_151150_remove_unique_index_on_external_id_column',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (129,'2018_02_17_134254_ensure_unique_allocation_id_on_servers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (130,'2018_02_24_112356_add_external_id_column_to_servers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (131,'2018_02_25_160152_remove_default_null_value_on_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (132,'2018_02_25_160604_define_unique_index_on_users_external_id',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (133,'2018_03_01_192831_add_database_and_port_limit_columns_to_servers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (134,'2018_03_15_124536_add_description_to_nodes',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (135,'2018_05_04_123826_add_maintenance_to_nodes',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (136,'2018_09_03_143756_allow_egg_variables_to_have_longer_values',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (137,'2018_09_03_144005_allow_server_variables_to_have_longer_values',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (138,'2019_03_02_142328_set_allocation_limit_default_null',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (139,'2019_03_02_151321_fix_unique_index_to_account_for_host',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (140,'2020_03_22_163911_merge_permissions_table_into_subusers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (141,'2020_03_22_164814_drop_permissions_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (142,'2020_04_03_203624_add_threads_column_to_servers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (143,'2020_04_03_230614_create_backups_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (144,'2020_04_04_131016_add_table_server_transfers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (145,'2020_04_10_141024_store_node_tokens_as_encrypted_value',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (146,'2020_04_17_203438_allow_nullable_descriptions',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (147,'2020_04_22_055500_add_max_connections_column',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (148,'2020_04_26_111208_add_backup_limit_to_servers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (149,'2020_05_20_234655_add_mounts_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (150,'2020_05_21_192756_add_mount_server_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (151,'2020_07_02_213612_create_user_recovery_tokens_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (152,'2020_07_09_201845_add_notes_column_for_allocations',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (153,'2020_08_20_205533_add_backup_state_column_to_backups',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (154,'2020_08_22_132500_update_bytes_to_unsigned_bigint',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (155,'2020_08_23_175331_modify_checksums_column_for_backups',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (156,'2020_09_13_110007_drop_packs_from_servers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (157,'2020_09_13_110021_drop_packs_from_api_key_permissions',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (158,'2020_09_13_110047_drop_packs_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (159,'2020_09_13_113503_drop_daemon_key_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (160,'2020_10_10_165437_change_unique_database_name_to_account_for_server',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (161,'2020_10_26_194904_remove_nullable_from_schedule_name_field',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (162,'2020_11_02_201014_add_features_column_to_eggs',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (163,'2020_12_12_102435_support_multiple_docker_images_and_updates',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (164,'2020_12_14_013707_make_successful_nullable_in_server_transfers',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (165,'2020_12_17_014330_add_archived_field_to_server_transfers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (166,'2020_12_24_092449_make_allocation_fields_json',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (167,'2020_12_26_184914_add_upload_id_column_to_backups_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (168,'2021_01_10_153937_add_file_denylist_to_egg_configs',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (169,'2021_01_13_013420_add_cron_month',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (170,'2021_01_17_102401_create_audit_logs_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (171,'2021_01_17_152623_add_generic_server_status_column',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (172,'2021_01_26_210502_update_file_denylist_to_json',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (173,'2021_02_23_205021_add_index_for_server_and_action',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (174,'2021_02_23_212657_make_sftp_port_unsigned_int',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (175,'2021_03_21_104718_force_cron_month_field_to_have_value_if_missing',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (176,'2021_05_01_092457_add_continue_on_failure_option_to_tasks',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (177,'2021_05_01_092523_add_only_run_when_server_online_option_to_schedules',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (178,'2021_05_03_201016_add_support_for_locking_a_backup',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (179,'2021_07_12_013420_remove_userinteraction',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (180,'2021_07_17_211512_create_user_ssh_keys_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (181,'2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (182,'2021_08_21_175111_add_foreign_keys_to_mount_node_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (183,'2021_08_21_175118_add_foreign_keys_to_mount_server_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (184,'2021_08_21_180921_add_foreign_keys_to_egg_mount_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (185,'2022_01_25_030847_drop_google_analytics',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (186,'2022_05_07_165334_migrate_egg_images_array_to_new_format',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (187,'2022_05_28_135717_create_activity_logs_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (188,'2022_05_29_140349_create_activity_log_actors_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (189,'2022_06_18_112822_track_api_key_usage_for_activity_events',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (190,'2022_08_16_214400_add_force_outgoing_ip_column_to_eggs_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (191,'2022_08_16_230204_add_installed_at_column_to_servers_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (192,'2022_12_12_213937_update_mail_settings_to_new_format',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (193,'2023_01_24_210051_add_uuid_column_to_failed_jobs_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (194,'2023_02_23_191004_add_expires_at_column_to_api_keys_table',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (197,'2024_03_12_154408_remove_nests_table',2); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (198,'2024_03_14_055537_remove_locations_table',2); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (201,'2024_04_20_214441_add_egg_var_sort',3); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (203,'2024_04_14_002250_update_column_names',4); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (204,'2024_05_08_094823_rename_oom_disabled_column_to_oom_killer',1); -INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (205,'2024_05_16_091207_add_cpu_columns_to_nodes_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (57,'2016_11_11_220649_add_pack_support',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (58,'2016_11_11_231731_set_service_name_unique',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (59,'2016_11_27_142519_add_pack_column',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (60,'2016_12_01_173018_add_configurable_upload_limit',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (61,'2016_12_02_185206_correct_service_variables',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (62,'2017_01_07_154228_create_node_configuration_tokens_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (63,'2017_01_12_135449_add_more_user_data',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (64,'2017_02_02_175548_UpdateColumnNames',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (65,'2017_02_03_140948_UpdateNodesTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (66,'2017_02_03_155554_RenameColumns',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (67,'2017_02_05_164123_AdjustColumnNames',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (68,'2017_02_05_164516_AdjustColumnNamesForServicePacks',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (69,'2017_02_09_174834_SetupPermissionsPivotTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (70,'2017_02_10_171858_UpdateAPIKeyColumnNames',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (71,'2017_03_03_224254_UpdateNodeConfigTokensColumns',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (72,'2017_03_05_212803_DeleteServiceExecutableOption',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (73,'2017_03_10_162934_AddNewServiceOptionsColumns',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (74,'2017_03_10_173607_MigrateToNewServiceSystem',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (75,'2017_03_11_215455_ChangeServiceVariablesValidationRules',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (76,'2017_03_12_150648_MoveFunctionsFromFileToDatabase',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (77,'2017_03_14_175631_RenameServicePacksToSingluarPacks',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (78,'2017_03_14_200326_AddLockedStatusToTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (79,'2017_03_16_181109_ReOrganizeDatabaseServersToDatabaseHost',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (80,'2017_03_16_181515_CleanupDatabasesDatabase',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (81,'2017_03_18_204953_AddForeignKeyToPacks',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (82,'2017_03_31_221948_AddServerDescriptionColumn',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (83,'2017_04_02_163232_DropDeletedAtColumnFromServers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (84,'2017_04_15_125021_UpgradeTaskSystem',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (85,'2017_04_20_171943_AddScriptsToServiceOptions',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (86,'2017_04_21_151432_AddServiceScriptTrackingToServers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (87,'2017_04_27_145300_AddCopyScriptFromColumn',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (88,'2017_04_27_223629_AddAbilityToDefineConnectionOverSSLWithDaemonBehindProxy',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (89,'2017_05_01_141528_DeleteDownloadTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (90,'2017_05_01_141559_DeleteNodeConfigurationTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (91,'2017_06_10_152951_add_external_id_to_users',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (92,'2017_06_25_133923_ChangeForeignKeyToBeOnCascadeDelete',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (93,'2017_07_08_152806_ChangeUserPermissionsToDeleteOnUserDeletion',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (94,'2017_07_08_154416_SetAllocationToReferenceNullOnServerDelete',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (95,'2017_07_08_154650_CascadeDeletionWhenAServerOrVariableIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (96,'2017_07_24_194433_DeleteTaskWhenParentServerIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (97,'2017_08_05_115800_CascadeNullValuesForDatabaseHostWhenNodeIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (98,'2017_08_05_144104_AllowNegativeValuesForOverallocation',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (99,'2017_08_05_174811_SetAllocationUnqiueUsingMultipleFields',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (100,'2017_08_15_214555_CascadeDeletionWhenAParentServiceIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (101,'2017_08_18_215428_RemovePackWhenParentServiceOptionIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (102,'2017_09_10_225749_RenameTasksTableForStructureRefactor',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (103,'2017_09_10_225941_CreateSchedulesTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (104,'2017_09_10_230309_CreateNewTasksTableForSchedules',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (105,'2017_09_11_002938_TransferOldTasksToNewScheduler',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (106,'2017_09_13_211810_UpdateOldPermissionsToPointToNewScheduleSystem',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (107,'2017_09_23_170933_CreateDaemonKeysTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (108,'2017_09_23_173628_RemoveDaemonSecretFromServersTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (109,'2017_09_23_185022_RemoveDaemonSecretFromSubusersTable',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (110,'2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (111,'2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (112,'2017_10_03_233202_CascadeDeletionWhenServiceOptionIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (113,'2017_10_06_214026_ServicesToNestsConversion',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (114,'2017_10_06_214053_ServiceOptionsToEggsConversion',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (115,'2017_10_06_215741_ServiceVariablesToEggVariablesConversion',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (116,'2017_10_24_222238_RemoveLegacySFTPInformation',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (117,'2017_11_11_161922_Add2FaLastAuthorizationTimeColumn',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (118,'2017_11_19_122708_MigratePubPrivFormatToSingleKey',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (119,'2017_12_04_184012_DropAllocationsWhenNodeIsDeleted',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (120,'2017_12_12_220426_MigrateSettingsTableToNewFormat',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (121,'2018_01_01_122821_AllowNegativeValuesForServerSwap',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (122,'2018_01_11_213943_AddApiKeyPermissionColumns',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (123,'2018_01_13_142012_SetupTableForKeyEncryption',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (124,'2018_01_13_145209_AddLastUsedAtColumn',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (125,'2018_02_04_145617_AllowTextInUserExternalId',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (126,'2018_02_10_151150_remove_unique_index_on_external_id_column',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (127,'2018_02_17_134254_ensure_unique_allocation_id_on_servers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (128,'2018_02_24_112356_add_external_id_column_to_servers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (129,'2018_02_25_160152_remove_default_null_value_on_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (130,'2018_02_25_160604_define_unique_index_on_users_external_id',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (131,'2018_03_01_192831_add_database_and_port_limit_columns_to_servers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (132,'2018_03_15_124536_add_description_to_nodes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (133,'2018_05_04_123826_add_maintenance_to_nodes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (134,'2018_09_03_143756_allow_egg_variables_to_have_longer_values',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (135,'2018_09_03_144005_allow_server_variables_to_have_longer_values',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (136,'2019_03_02_142328_set_allocation_limit_default_null',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (137,'2019_03_02_151321_fix_unique_index_to_account_for_host',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (138,'2020_03_22_163911_merge_permissions_table_into_subusers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (139,'2020_03_22_164814_drop_permissions_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (140,'2020_04_03_203624_add_threads_column_to_servers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (141,'2020_04_03_230614_create_backups_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (142,'2020_04_04_131016_add_table_server_transfers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (143,'2020_04_10_141024_store_node_tokens_as_encrypted_value',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (144,'2020_04_17_203438_allow_nullable_descriptions',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (145,'2020_04_22_055500_add_max_connections_column',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (146,'2020_04_26_111208_add_backup_limit_to_servers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (147,'2020_05_20_234655_add_mounts_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (148,'2020_05_21_192756_add_mount_server_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (149,'2020_07_02_213612_create_user_recovery_tokens_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (150,'2020_07_09_201845_add_notes_column_for_allocations',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (151,'2020_08_20_205533_add_backup_state_column_to_backups',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (152,'2020_08_22_132500_update_bytes_to_unsigned_bigint',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (153,'2020_08_23_175331_modify_checksums_column_for_backups',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (154,'2020_09_13_110007_drop_packs_from_servers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (155,'2020_09_13_110021_drop_packs_from_api_key_permissions',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (156,'2020_09_13_110047_drop_packs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (157,'2020_09_13_113503_drop_daemon_key_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (158,'2020_10_10_165437_change_unique_database_name_to_account_for_server',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (159,'2020_10_26_194904_remove_nullable_from_schedule_name_field',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (160,'2020_11_02_201014_add_features_column_to_eggs',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (161,'2020_12_12_102435_support_multiple_docker_images_and_updates',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (162,'2020_12_14_013707_make_successful_nullable_in_server_transfers',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (163,'2020_12_17_014330_add_archived_field_to_server_transfers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (164,'2020_12_24_092449_make_allocation_fields_json',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (165,'2020_12_26_184914_add_upload_id_column_to_backups_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (166,'2021_01_10_153937_add_file_denylist_to_egg_configs',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (167,'2021_01_13_013420_add_cron_month',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (168,'2021_01_17_102401_create_audit_logs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (169,'2021_01_17_152623_add_generic_server_status_column',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (170,'2021_01_26_210502_update_file_denylist_to_json',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (171,'2021_02_23_205021_add_index_for_server_and_action',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (172,'2021_02_23_212657_make_sftp_port_unsigned_int',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (173,'2021_03_21_104718_force_cron_month_field_to_have_value_if_missing',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (174,'2021_05_01_092457_add_continue_on_failure_option_to_tasks',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (175,'2021_05_01_092523_add_only_run_when_server_online_option_to_schedules',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (176,'2021_05_03_201016_add_support_for_locking_a_backup',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (177,'2021_07_12_013420_remove_userinteraction',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (178,'2021_07_17_211512_create_user_ssh_keys_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (179,'2021_08_03_210600_change_successful_field_to_default_to_false_on_backups_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (180,'2021_08_21_175111_add_foreign_keys_to_mount_node_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (181,'2021_08_21_175118_add_foreign_keys_to_mount_server_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (182,'2021_08_21_180921_add_foreign_keys_to_egg_mount_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (183,'2022_01_25_030847_drop_google_analytics',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (184,'2022_05_07_165334_migrate_egg_images_array_to_new_format',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (185,'2022_05_28_135717_create_activity_logs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (186,'2022_05_29_140349_create_activity_log_actors_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (187,'2022_06_18_112822_track_api_key_usage_for_activity_events',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (188,'2022_08_16_214400_add_force_outgoing_ip_column_to_eggs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (189,'2022_08_16_230204_add_installed_at_column_to_servers_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (190,'2022_12_12_213937_update_mail_settings_to_new_format',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (191,'2023_01_24_210051_add_uuid_column_to_failed_jobs_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (192,'2023_02_23_191004_add_expires_at_column_to_api_keys_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (193,'2024_03_12_154408_remove_nests_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (194,'2024_03_14_055537_remove_locations_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (195,'2024_04_14_002250_update_column_names',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (196,'2024_04_20_214441_add_egg_var_sort',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (197,'2024_04_28_184102_add_mounts_to_api_keys',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (198,'2024_05_08_094823_rename_oom_disabled_column_to_oom_killer',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (199,'2024_05_16_091207_add_cpu_columns_to_nodes_table',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (200,'2024_05_20_002841_add_docker_container_label',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (201,'2024_05_31_204646_fix_old_encrypted_values',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (202,'2024_06_02_205622_update_stock_egg_uuid',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (203,'2024_06_04_085042_add_daemon_sftp_alias_column_to_nodes',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (204,'2024_06_05_220135_update_egg_config_variables',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (205,'2024_06_08_020904_refix_egg_variables',1); +INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (206,'2024_06_11_220722_update_field_length',1); diff --git a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php index ce382d6ec..7175a7cc7 100644 --- a/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php +++ b/tests/Integration/Api/Client/Server/Subuser/CreateServerSubuserTest.php @@ -80,7 +80,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase { [$user, $server] = $this->generateTestAccount(); - $email = str_repeat(Str::random(20), 9) . '1@gmail.com'; // 191 is the hard limit for the column in MySQL. + $email = str_repeat(Str::random(35), 7) . '@gmail.com'; // 255 is the hard limit for the column in MySQL. $response = $this->actingAs($user)->postJson($this->link($server) . '/users', [ 'email' => $email, @@ -99,7 +99,7 @@ class CreateServerSubuserTest extends ClientApiIntegrationTestCase ]); $response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY); - $response->assertJsonPath('errors.0.detail', 'The email must be between 1 and 191 characters.'); + $response->assertJsonPath('errors.0.detail', 'The email must be between 1 and 255 characters.'); $response->assertJsonPath('errors.0.meta.source_field', 'email'); } From 87dc8066c9cced07d444e5e82f7c53dc5c5c0ffe Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Sun, 16 Jun 2024 20:01:27 +0200 Subject: [PATCH 07/26] Update required (#401) --- .../NodeResource/Pages/CreateNode.php | 19 ++++++++++++------- .../Resources/NodeResource/Pages/EditNode.php | 1 - 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Filament/Resources/NodeResource/Pages/CreateNode.php b/app/Filament/Resources/NodeResource/Pages/CreateNode.php index 23b192457..7a7465726 100644 --- a/app/Filament/Resources/NodeResource/Pages/CreateNode.php +++ b/app/Filament/Resources/NodeResource/Pages/CreateNode.php @@ -158,7 +158,6 @@ class CreateNode extends CreateRecord 'md' => 1, 'lg' => 1, ]) - ->required() ->inline() ->helperText(function (Forms\Get $get) { if (request()->isSecure()) { @@ -279,7 +278,8 @@ class CreateNode extends CreateRecord ->columnSpan(2) ->numeric() ->minValue(0) - ->default(0), + ->default(0) + ->required(), Forms\Components\TextInput::make('memory_overallocate') ->dehydratedWhenHidden() ->label('Overallocate')->inlineLabel() @@ -291,7 +291,8 @@ class CreateNode extends CreateRecord ->minValue(-1) ->maxValue(100) ->default(0) - ->suffix('%'), + ->suffix('%') + ->required(), ]), Forms\Components\Grid::make() ->columns(6) @@ -320,7 +321,8 @@ class CreateNode extends CreateRecord ->columnSpan(2) ->numeric() ->minValue(0) - ->default(0), + ->default(0) + ->required(), Forms\Components\TextInput::make('disk_overallocate') ->dehydratedWhenHidden() ->hidden(fn (Forms\Get $get) => $get('unlimited_disk')) @@ -332,7 +334,8 @@ class CreateNode extends CreateRecord ->minValue(-1) ->maxValue(100) ->default(0) - ->suffix('%'), + ->suffix('%') + ->required(), ]), Forms\Components\Grid::make() ->columns(6) @@ -361,7 +364,8 @@ class CreateNode extends CreateRecord ->columnSpan(2) ->numeric() ->default(0) - ->minValue(0), + ->minValue(0) + ->required(), Forms\Components\TextInput::make('cpu_overallocate') ->dehydratedWhenHidden() ->hidden(fn (Forms\Get $get) => $get('unlimited_cpu')) @@ -373,7 +377,8 @@ class CreateNode extends CreateRecord ->default(0) ->minValue(-1) ->maxValue(100) - ->suffix('%'), + ->suffix('%') + ->required(), ]), ]), ])->columnSpanFull() diff --git a/app/Filament/Resources/NodeResource/Pages/EditNode.php b/app/Filament/Resources/NodeResource/Pages/EditNode.php index f9286cf70..4d2dae7a4 100644 --- a/app/Filament/Resources/NodeResource/Pages/EditNode.php +++ b/app/Filament/Resources/NodeResource/Pages/EditNode.php @@ -159,7 +159,6 @@ class EditNode extends EditRecord 'md' => 1, 'lg' => 1, ]) - ->required() ->inline() ->helperText(function (Forms\Get $get) { if (request()->isSecure()) { From 6b5b4809022c20250838782905b7aecef159eaf4 Mon Sep 17 00:00:00 2001 From: notCharles Date: Sun, 16 Jun 2024 14:21:25 -0400 Subject: [PATCH 08/26] Update database section on EditServer --- .../DatabasesRelationManager.php | 2 - .../ServerResource/Pages/EditServer.php | 65 +++++++++++++------ 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php index e3b622840..e61d19625 100644 --- a/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php +++ b/app/Filament/Resources/DatabaseHostResource/RelationManagers/DatabasesRelationManager.php @@ -44,7 +44,6 @@ class DatabasesRelationManager extends RelationManager ->columns([ Tables\Columns\TextColumn::make('database')->icon('tabler-database'), Tables\Columns\TextColumn::make('username')->icon('tabler-user'), - //Tables\Columns\TextColumn::make('password'), Tables\Columns\TextColumn::make('remote'), Tables\Columns\TextColumn::make('server.name') ->icon('tabler-brand-docker') @@ -55,7 +54,6 @@ class DatabasesRelationManager extends RelationManager ->actions([ Tables\Actions\DeleteAction::make(), Tables\Actions\ViewAction::make()->color('primary'), - //Tables\Actions\EditAction::make(), ]); } diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index eb345aa77..899fe6101 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -2,10 +2,11 @@ namespace App\Filament\Resources\ServerResource\Pages; +use App\Models\Database; use App\Services\Databases\DatabaseManagementService; +use App\Services\Databases\DatabasePasswordService; use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Repeater; -use Filament\Forms\Components\TextInput; use LogicException; use App\Filament\Resources\ServerResource; use App\Http\Controllers\Admin\ServersController; @@ -592,34 +593,49 @@ class EditServer extends EditRecord ->icon('tabler-database') ->schema([ Repeater::make('databases') - ->columnSpanFull() ->grid() + ->helperText(fn (Server $server) => $server->databases->isNotEmpty() ? '' : 'No Databases exist for this Server') + ->columns(2) ->schema([ - TextInput::make('db_name') + Forms\Components\TextInput::make('database') + ->columnSpan(2) ->label('Database Name') + ->disabled() + ->formatStateUsing(fn ($record) => $record->database) ->hintAction( Action::make('Delete') ->color('danger') ->icon('tabler-trash') ->action(fn (DatabaseManagementService $databaseManagementService, $record) => $databaseManagementService->delete($record)) - ) - ->formatStateUsing(fn ($record) => $record->database) - ->readOnly(), - TextInput::make('db_username') - ->label('Username') - ->inlineLabel() + ), + Forms\Components\TextInput::make('username') + ->disabled() ->formatStateUsing(fn ($record) => $record->username) - ->readOnly(), - TextInput::make('db_password') - ->label('Password') - ->inlineLabel() - ->formatStateUsing(fn ($record) => $record->password) - ->readOnly(), - TextInput::make('db_max_connections') - ->label('Max Connections') - ->inlineLabel() - ->formatStateUsing(fn ($record) => $record->max_connections < 1 ? 'Unlimited' : $record->max_connections) - ->readOnly(), + ->columnSpan(2), + Forms\Components\TextInput::make('password') + ->disabled() + ->hintAction( + Action::make('rotate') + ->icon('tabler-refresh') + ->requiresConfirmation() + ->action(fn (DatabasePasswordService $service, $record, $set, $get) => $this->rotatePassword($service, $record, $set, $get)) + ) + ->formatStateUsing(fn (Database $database) => $database->password) + ->columnSpan(2), + Forms\Components\TextInput::make('remote') + ->disabled() + ->formatStateUsing(fn ($record) => $record->remote) + ->columnSpan(1) + ->label('Connections From'), + Forms\Components\TextInput::make('max_connections') + ->disabled() + ->formatStateUsing(fn ($record) => $record->max_connections) + ->columnSpan(1), + Forms\Components\TextInput::make('JDBC') + ->disabled() + ->label('JDBC Connection String') + ->columnSpan(2) + ->formatStateUsing(fn (Forms\Get $get, $record) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($record->password) . '@' . $record->host->host . ':' . $record->host->port . '/' . $get('database')), ]) ->relationship('databases') ->deletable(false) @@ -825,4 +841,13 @@ class EditServer extends EditRecord ->mapWithKeys(fn ($value) => [$value => $value]) ->all(); } + + protected function rotatePassword(DatabasePasswordService $service, $record, $set, $get): void + { + $newPassword = $service->handle($record); + $jdbcString = 'jdbc:mysql://' . $get('username') . ':' . urlencode($newPassword) . '@' . $record->host->host . ':' . $record->host->port . '/' . $get('database'); + + $set('password', $newPassword); + $set('JDBC', $jdbcString); + } } From d7316c4dfe18ff9a34b5abf74564133812d41317 Mon Sep 17 00:00:00 2001 From: Senna <62171904+Poseidon281@users.noreply.github.com> Date: Sun, 16 Jun 2024 23:54:49 +0200 Subject: [PATCH 09/26] Dashboard update. Update section (#390) * Created command * Pint Fixes * Removed old upgrade command translations * Update to Dashboard and linting Dashboard view * Pint Fixes * A few small improvements * Delete modifications to upgrade command * Revert "Removed old upgrade command translations" This reverts commit 31315a0d9e2cd1cb43f01c2bbca9b4a4a06b34c1. * Pint Fixes * Boy132's Suggestions --- lang/en/dashboard/index.php | 8 ++- .../views/filament/pages/dashboard.blade.php | 58 ++++++++++--------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/lang/en/dashboard/index.php b/lang/en/dashboard/index.php index 2c201a30b..72867b654 100644 --- a/lang/en/dashboard/index.php +++ b/lang/en/dashboard/index.php @@ -19,9 +19,13 @@ return [ 'button_issues' => 'Create Issue', 'button_features' => 'Discuss Features', ], - 'intro-update' => [ + 'intro-update-available' => [ 'heading' => 'Update available', - 'content' => ':latestVersion is available! Read our documentation to update your Panel.', + 'content' => ':latestVersion is now available! Read our documentation to update your Panel.', + ], + 'intro-no-update' => [ + 'heading' => 'Your Panel is up to date', + 'content' => 'You are currently using :version. Your panel is up-to-date!', ], 'intro-first-node' => [ 'heading' => 'No Nodes Detected', diff --git a/resources/views/filament/pages/dashboard.blade.php b/resources/views/filament/pages/dashboard.blade.php index ef7f539bd..dae169716 100644 --- a/resources/views/filament/pages/dashboard.blade.php +++ b/resources/views/filament/pages/dashboard.blade.php @@ -1,5 +1,4 @@ - {{ trans('dashboard/index.expand_sections') }}

+ @if (!$isLatest) + + {{ trans('dashboard/index.sections.intro-update-available.heading') }} + +

{{ trans('dashboard/index.sections.intro-update-available.content', ['latestVersion' => $latestVersion]) }}

+ +
+ @else + + {{ trans('dashboard/index.sections.intro-no-update.heading') }} + +

{{ trans('dashboard/index.sections.intro-no-update.content', ['version' => $version]) }}

+
+ @endif + + @if ($inDevelopment) {{ trans('dashboard/index.sections.intro-developers.heading') }} -

{{ trans('dashboard/index.sections.intro-developers.content') }}

+

{{ trans('dashboard/index.sections.intro-developers.content') }}


-

{{ trans('dashboard/index.sections.intro-developers.extra_note') }}

- -
- @endif - - @if (!$isLatest) - - {{ trans('dashboard/index.sections.intro-update.heading') }} - -

{{ trans('dashboard/index.sections.intro-update.content', ['latestVersion' => $latestVersion]) }}

+

{{ trans('dashboard/index.sections.intro-developers.extra_note') }}

@endif @@ -58,14 +66,13 @@ > {{ trans('dashboard/index.sections.intro-first-node.heading') }} -

{{ trans('dashboard/index.sections.intro-first-node.content') }}

+

{{ trans('dashboard/index.sections.intro-first-node.content') }}

@endif {{-- No Nodes Active --}} - {{ trans('dashboard/index.sections.intro-support.heading') }} -

{{ trans('dashboard/index.sections.intro-support.content') }}

+

{{ trans('dashboard/index.sections.intro-support.content') }}


-

{{ trans('dashboard/index.sections.intro-support.extra_note') }}

+

{{ trans('dashboard/index.sections.intro-support.extra_note') }}

- - - -
-
From d4eecdd53d0ac940709477270e949cba56678089 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Mon, 17 Jun 2024 13:03:36 +0200 Subject: [PATCH 10/26] Update OAuth migration (#409) --- .../migrations/2024_06_13_120409_add_oauth_column_to_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2024_06_13_120409_add_oauth_column_to_users.php b/database/migrations/2024_06_13_120409_add_oauth_column_to_users.php index 22273db94..c5e2b3308 100644 --- a/database/migrations/2024_06_13_120409_add_oauth_column_to_users.php +++ b/database/migrations/2024_06_13_120409_add_oauth_column_to_users.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::table('users', function (Blueprint $table) { - $table->json('oauth')->after('totp_authenticated_at'); + $table->json('oauth')->nullable()->after('totp_authenticated_at'); }); } From 276b51f47731ad7b7c03155cf2a8478e22e8bc87 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:51:04 +0200 Subject: [PATCH 11/26] Remove locationId in MakeNodeCommand (#405) * Concat + Default * Concat + Default + Enforce scheme * fix typo --------- Co-authored-by: Boy132 --- app/Console/Commands/Node/MakeNodeCommand.php | 16 ++++++++-------- .../Resources/NodeResource/Pages/CreateNode.php | 8 ++++---- .../Resources/NodeResource/Pages/EditNode.php | 8 ++++---- app/Models/Node.php | 2 +- lang/en/commands.php | 3 +-- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/Console/Commands/Node/MakeNodeCommand.php b/app/Console/Commands/Node/MakeNodeCommand.php index c57d4ee90..f78f73c25 100644 --- a/app/Console/Commands/Node/MakeNodeCommand.php +++ b/app/Console/Commands/Node/MakeNodeCommand.php @@ -57,19 +57,19 @@ class MakeNodeCommand extends Command $data['public'] = $this->option('public') ?? $this->confirm(__('commands.make_node.public'), true); $data['behind_proxy'] = $this->option('proxy') ?? $this->confirm(__('commands.make_node.behind_proxy')); $data['maintenance_mode'] = $this->option('maintenance') ?? $this->confirm(__('commands.make_node.maintenance_mode')); - $data['memory'] = $this->option('maxMemory') ?? $this->ask(__('commands.make_node.memory')); - $data['memory_overallocate'] = $this->option('overallocateMemory') ?? $this->ask(__('commands.make_node.memory_overallocate')); - $data['disk'] = $this->option('maxDisk') ?? $this->ask(__('commands.make_node.disk')); - $data['disk_overallocate'] = $this->option('overallocateDisk') ?? $this->ask(__('commands.make_node.disk_overallocate')); - $data['cpu'] = $this->option('maxCpu') ?? $this->ask(__('commands.make_node.cpu')); - $data['cpu_overallocate'] = $this->option('overallocateCpu') ?? $this->ask(__('commands.make_node.cpu_overallocate')); - $data['upload_size'] = $this->option('uploadSize') ?? $this->ask(__('commands.make_node.upload_size'), '100'); + $data['memory'] = $this->option('maxMemory') ?? $this->ask(__('commands.make_node.memory'), '0'); + $data['memory_overallocate'] = $this->option('overallocateMemory') ?? $this->ask(__('commands.make_node.memory_overallocate'), '-1'); + $data['disk'] = $this->option('maxDisk') ?? $this->ask(__('commands.make_node.disk'), '0'); + $data['disk_overallocate'] = $this->option('overallocateDisk') ?? $this->ask(__('commands.make_node.disk_overallocate'), '-1'); + $data['cpu'] = $this->option('maxCpu') ?? $this->ask(__('commands.make_node.cpu'), '0'); + $data['cpu_overallocate'] = $this->option('overallocateCpu') ?? $this->ask(__('commands.make_node.cpu_overallocate'), '-1'); + $data['upload_size'] = $this->option('uploadSize') ?? $this->ask(__('commands.make_node.upload_size'), '256'); $data['daemon_listen'] = $this->option('daemonListeningPort') ?? $this->ask(__('commands.make_node.daemonListen'), '8080'); $data['daemon_sftp'] = $this->option('daemonSFTPPort') ?? $this->ask(__('commands.make_node.daemonSFTP'), '2022'); $data['daemon_sftp_alias'] = $this->option('daemonSFTPAlias') ?? $this->ask(__('commands.make_node.daemonSFTPAlias'), ''); $data['daemon_base'] = $this->option('daemonBase') ?? $this->ask(__('commands.make_node.daemonBase'), '/var/lib/pelican/volumes'); $node = $this->creationService->handle($data); - $this->line(__('commands.make_node.succes1') . $data['name'] . __('commands.make_node.succes2') . $node->id . '.'); + $this->line(__('commands.make_node.success', ['name' => $data['name'], 'id' => $node->id])); } } diff --git a/app/Filament/Resources/NodeResource/Pages/CreateNode.php b/app/Filament/Resources/NodeResource/Pages/CreateNode.php index 7a7465726..34611416e 100644 --- a/app/Filament/Resources/NodeResource/Pages/CreateNode.php +++ b/app/Filament/Resources/NodeResource/Pages/CreateNode.php @@ -131,8 +131,8 @@ class CreateNode extends CreateRecord ]) ->label(trans('strings.port')) ->helperText('If you are running the daemon behind Cloudflare you should set the daemon port to 8443 to allow websocket proxying over SSL.') - ->minValue(0) - ->maxValue(65536) + ->minValue(1) + ->maxValue(65535) ->default(8080) ->required() ->integer(), @@ -242,8 +242,8 @@ class CreateNode extends CreateRecord Forms\Components\TextInput::make('daemon_sftp') ->columnSpan(1) ->label('SFTP Port') - ->minValue(0) - ->maxValue(65536) + ->minValue(1) + ->maxValue(65535) ->default(2022) ->required() ->integer(), diff --git a/app/Filament/Resources/NodeResource/Pages/EditNode.php b/app/Filament/Resources/NodeResource/Pages/EditNode.php index 4d2dae7a4..ccd2e97bb 100644 --- a/app/Filament/Resources/NodeResource/Pages/EditNode.php +++ b/app/Filament/Resources/NodeResource/Pages/EditNode.php @@ -132,8 +132,8 @@ class EditNode extends EditRecord ]) ->label(trans('strings.port')) ->helperText('If you are running the daemon behind Cloudflare you should set the daemon port to 8443 to allow websocket proxying over SSL.') - ->minValue(0) - ->maxValue(65536) + ->minValue(1) + ->maxValue(65535) ->default(8080) ->required() ->integer(), @@ -217,8 +217,8 @@ class EditNode extends EditRecord Forms\Components\TextInput::make('daemon_sftp') ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 1, 'lg' => 3]) ->label('SFTP Port') - ->minValue(0) - ->maxValue(65536) + ->minValue(1) + ->maxValue(65535) ->default(2022) ->required() ->integer(), diff --git a/app/Models/Node.php b/app/Models/Node.php index 4a44e6f57..473d3a4a2 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -83,7 +83,7 @@ class Node extends Model 'description' => 'string|nullable', 'public' => 'boolean', 'fqdn' => 'required|string', - 'scheme' => 'required', + 'scheme' => 'required|string|in:http,https', 'behind_proxy' => 'boolean', 'memory' => 'required|numeric|min:0', 'memory_overallocate' => 'required|numeric|min:-1', diff --git a/lang/en/commands.php b/lang/en/commands.php index ba0cc0723..a42ca228b 100644 --- a/lang/en/commands.php +++ b/lang/en/commands.php @@ -39,8 +39,7 @@ return [ 'daemonSFTP' => 'Enter the daemon SFTP listening port', 'daemonSFTPAlias' => 'Enter the daemon SFTP alias (can be empty)', 'daemonBase' => 'Enter the base folder', - 'succes1' => 'Successfully created a new node with the name: ', - 'succes2' => 'and has an id of: ', + 'success' => 'Successfully created a new node with the name :name and has an id of :id', ], 'node_config' => [ 'error_not_exist' => 'The selected node does not exist.', From 6692942f6f8f12f7a1d427237f24b40d1eeb6ba3 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Mon, 17 Jun 2024 12:12:56 -0400 Subject: [PATCH 12/26] Group servers (#412) * Group servers # Conflicts: # app/Filament/Resources/ServerResource/Pages/ListServers.php * Can be null apparently * pint --------- Co-authored-by: Charles --- .../Resources/ServerResource/Pages/ListServers.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Filament/Resources/ServerResource/Pages/ListServers.php b/app/Filament/Resources/ServerResource/Pages/ListServers.php index c60f1c6b0..0d28c23fc 100644 --- a/app/Filament/Resources/ServerResource/Pages/ListServers.php +++ b/app/Filament/Resources/ServerResource/Pages/ListServers.php @@ -7,6 +7,7 @@ use App\Models\Server; use Filament\Actions; use Filament\Resources\Pages\ListRecords; use Filament\Tables\Actions\CreateAction; +use Filament\Tables\Grouping\Group; use Filament\Tables\Table; use Filament\Tables; @@ -18,6 +19,12 @@ class ListServers extends ListRecords { return $table ->searchable(false) + ->defaultGroup('node.name') + ->groups([ + Group::make('node.name')->getDescriptionFromRecordUsing(fn (Server $server): string => str($server->node->description)->limit(150)), + Group::make('user.username')->getDescriptionFromRecordUsing(fn (Server $server): string => $server->user->email), + Group::make('egg.name')->getDescriptionFromRecordUsing(fn (Server $server): string => str($server->egg->description)->limit(150)), + ]) ->columns([ Tables\Columns\TextColumn::make('status') ->default('unknown') @@ -52,17 +59,20 @@ class ListServers extends ListRecords Tables\Columns\TextColumn::make('node.name') ->icon('tabler-server-2') ->url(fn (Server $server): string => route('filament.admin.resources.nodes.edit', ['record' => $server->node])) + ->hidden(fn (Table $table) => $table->getGrouping()?->getId() === 'node.name') ->sortable() ->searchable(), Tables\Columns\TextColumn::make('egg.name') ->icon('tabler-egg') ->url(fn (Server $server): string => route('filament.admin.resources.eggs.edit', ['record' => $server->egg])) + ->hidden(fn (Table $table) => $table->getGrouping()?->getId() === 'egg.name') ->sortable() ->searchable(), Tables\Columns\TextColumn::make('user.username') ->icon('tabler-user') ->label('Owner') ->url(fn (Server $server): string => route('filament.admin.resources.users.edit', ['record' => $server->user])) + ->hidden(fn (Table $table) => $table->getGrouping()?->getId() === 'user.username') ->sortable() ->searchable(), Tables\Columns\SelectColumn::make('allocation_id') From c431775b7e42c6eb4139d39697cad86a85408394 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 17 Jun 2024 12:24:52 -0400 Subject: [PATCH 13/26] [Create Server] Fix 500 when changing egg When changing from one egg to nothing, a 500 is displayed due to it expecting startup to have a value --- app/Filament/Resources/ServerResource/Pages/CreateServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Resources/ServerResource/Pages/CreateServer.php b/app/Filament/Resources/ServerResource/Pages/CreateServer.php index d62a7d31e..53a3fe2de 100644 --- a/app/Filament/Resources/ServerResource/Pages/CreateServer.php +++ b/app/Filament/Resources/ServerResource/Pages/CreateServer.php @@ -300,7 +300,7 @@ class CreateServer extends CreateRecord ->live() ->afterStateUpdated(function ($state, Forms\Set $set, Forms\Get $get, $old) { $egg = Egg::query()->find($state); - $set('startup', $egg->startup); + $set('startup', $egg->startup ?? ''); $set('image', ''); $variables = $egg->variables ?? []; From 7813b6060c2ab5a090cb788c0b87712bd3de83ea Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 18 Jun 2024 22:05:08 +0200 Subject: [PATCH 14/26] Make oauth nullable & remove middleware from oauth callback (#418) * make oauth nullable * fix oauth callback middleware --- app/Models/User.php | 4 ++-- routes/auth.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index ebe905a6f..b49d2f677 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -42,7 +42,7 @@ use App\Notifications\SendPasswordReset as ResetPasswordNotification; * @property bool $use_totp * @property string|null $totp_secret * @property \Illuminate\Support\Carbon|null $totp_authenticated_at - * @property array $oauth + * @property array|null $oauth * @property bool $gravatar * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at @@ -165,7 +165,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac 'language' => 'string', 'use_totp' => 'boolean', 'totp_secret' => 'nullable|string', - 'oauth' => 'array', + 'oauth' => 'array|nullable', ]; protected function casts(): array diff --git a/routes/auth.php b/routes/auth.php index 7c572c91b..671bc462e 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -20,7 +20,7 @@ Route::get('/password/reset/{token}', [Auth\LoginController::class, 'index'])->n // Endpoints for OAuth Route::get('/oauth/redirect/{driver}', [Auth\OAuthController::class, 'redirect'])->name('auth.oauth.redirect'); -Route::get('/oauth/callback/{driver}', [Auth\OAuthController::class, 'callback'])->name('auth.oauth.callback'); +Route::get('/oauth/callback/{driver}', [Auth\OAuthController::class, 'callback'])->name('auth.oauth.callback')->withoutMiddleware('guest'); // Apply a throttle to authentication action endpoints, in addition to the // recaptcha endpoints to slow down manual attack spammers even more. 🤷‍ From 7b0a15e7468753a2003eeae8e92e9c5539a3b53c Mon Sep 17 00:00:00 2001 From: Boy132 Date: Wed, 19 Jun 2024 16:04:00 +0200 Subject: [PATCH 15/26] Remove hard coded queue name for RunTaskJob (#420) --- app/Jobs/Schedule/RunTaskJob.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/Schedule/RunTaskJob.php b/app/Jobs/Schedule/RunTaskJob.php index 8977d3c17..0d2b255a6 100644 --- a/app/Jobs/Schedule/RunTaskJob.php +++ b/app/Jobs/Schedule/RunTaskJob.php @@ -24,7 +24,7 @@ class RunTaskJob extends Job implements ShouldQueue */ public function __construct(public Task $task, public bool $manualRun = false) { - $this->queue = 'standard'; + } /** From d6b71885ec262826a08fed1ce94344eb8ea695f2 Mon Sep 17 00:00:00 2001 From: notCharles Date: Thu, 20 Jun 2024 16:00:17 -0400 Subject: [PATCH 16/26] Add env. to egg upgrader --- app/Services/Eggs/Sharing/EggImporterService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 1e85923d7..c4fb27db9 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -23,6 +23,7 @@ class EggImporterService 'server.build.memory' => 'server.build.memory_limit', 'server.build.env.' => 'server.environment.', 'server.build.environment.' => 'server.environment.', + 'env.' => 'server.environment.', ]; public function __construct(protected ConnectionInterface $connection) From 42ca4e7fba6c06b1fdbbb74a803bb4f4b6fdf823 Mon Sep 17 00:00:00 2001 From: notCharles Date: Thu, 20 Jun 2024 16:15:56 -0400 Subject: [PATCH 17/26] This never happened... --- app/Services/Eggs/EggConfigurationService.php | 2 +- app/Services/Eggs/Sharing/EggImporterService.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index cfe458403..748b8f812 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -164,7 +164,7 @@ class EggConfigurationService // variable from the server configuration. $plucked = Arr::get( $structure, - preg_replace('/^env\./', 'build.environment.', $key), + preg_replace('/^env\./', 'server.environment.', $key), '' ); diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index c4fb27db9..1e85923d7 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -23,7 +23,6 @@ class EggImporterService 'server.build.memory' => 'server.build.memory_limit', 'server.build.env.' => 'server.environment.', 'server.build.environment.' => 'server.environment.', - 'env.' => 'server.environment.', ]; public function __construct(protected ConnectionInterface $connection) From a1190c12e00b749cb1227fd7cf9229261ea8b611 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 21 Jun 2024 16:17:44 -0400 Subject: [PATCH 18/26] Add required to editing server variables and fix #413 (#415) * Add required to editing server variables * Misplaced --- app/Filament/Resources/ServerResource/Pages/EditServer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index 38dae6671..a32928b58 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -543,6 +543,7 @@ class EditServer extends EditRecord $text = Forms\Components\TextInput::make('variable_value') ->hidden($this->shouldHideComponent(...)) + ->required(fn (ServerVariable $serverVariable) => in_array('required', explode('|', $serverVariable->variable->rules))) ->rules([ fn (ServerVariable $serverVariable): Closure => function (string $attribute, $value, Closure $fail) use ($serverVariable) { $validator = Validator::make(['validatorkey' => $value], [ From 5409532ca178fb4585c57dbd81363e19edfcdd23 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 23 Jun 2024 16:23:11 +0200 Subject: [PATCH 19/26] Fix the fix (#424) --- app/Services/Eggs/EggConfigurationService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Eggs/EggConfigurationService.php b/app/Services/Eggs/EggConfigurationService.php index 748b8f812..90c9427e4 100644 --- a/app/Services/Eggs/EggConfigurationService.php +++ b/app/Services/Eggs/EggConfigurationService.php @@ -164,7 +164,7 @@ class EggConfigurationService // variable from the server configuration. $plucked = Arr::get( $structure, - preg_replace('/^env\./', 'server.environment.', $key), + preg_replace('/^env\./', 'environment.', $key), '' ); From 70c31eef8fcf4de7115dc62809f3271a8bfafd9c Mon Sep 17 00:00:00 2001 From: Boy132 Date: Sun, 23 Jun 2024 16:33:18 +0200 Subject: [PATCH 20/26] Refactor UserTransformers (#423) * remove AccountTransformer and update UserTransformer (client api) to match UserTransformer (application api) * rename "toVueObject" * fix tests * forgot to rename this * backwards compat * fix tests --- .../Api/Client/AccountController.php | 4 +-- .../Auth/AbstractLoginController.php | 2 +- app/Models/User.php | 4 +-- .../Api/Application/UserTransformer.php | 3 +- .../Api/Client/AccountTransformer.php | 32 ------------------- .../Api/Client/UserTransformer.php | 20 ++++++++---- resources/views/templates/wrapper.blade.php | 2 +- .../Application/Users/UserControllerTest.php | 6 ++-- .../Api/Client/AccountControllerTest.php | 11 +++++-- 9 files changed, 33 insertions(+), 51 deletions(-) delete mode 100644 app/Transformers/Api/Client/AccountTransformer.php diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index 49f64bed6..6a0862d6b 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -8,9 +8,9 @@ use Illuminate\Auth\AuthManager; use Illuminate\Http\JsonResponse; use App\Facades\Activity; use App\Services\Users\UserUpdateService; -use App\Transformers\Api\Client\AccountTransformer; use App\Http\Requests\Api\Client\Account\UpdateEmailRequest; use App\Http\Requests\Api\Client\Account\UpdatePasswordRequest; +use App\Transformers\Api\Client\UserTransformer; class AccountController extends ClientApiController { @@ -25,7 +25,7 @@ class AccountController extends ClientApiController public function index(Request $request): array { return $this->fractal->item($request->user()) - ->transformWith($this->getTransformer(AccountTransformer::class)) + ->transformWith($this->getTransformer(UserTransformer::class)) ->toArray(); } diff --git a/app/Http/Controllers/Auth/AbstractLoginController.php b/app/Http/Controllers/Auth/AbstractLoginController.php index 6a25cf013..e5b50d0ad 100644 --- a/app/Http/Controllers/Auth/AbstractLoginController.php +++ b/app/Http/Controllers/Auth/AbstractLoginController.php @@ -83,7 +83,7 @@ abstract class AbstractLoginController extends Controller 'data' => [ 'complete' => true, 'intended' => $this->redirectPath(), - 'user' => $user->toVueObject(), + 'user' => $user->toReactObject(), ], ]); } diff --git a/app/Models/User.php b/app/Models/User.php index b49d2f677..c3acfbb46 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -215,9 +215,9 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac } /** - * Return the user model in a format that can be passed over to Vue templates. + * Return the user model in a format that can be passed over to React templates. */ - public function toVueObject(): array + public function toReactObject(): array { return collect($this->toArray())->except(['id', 'external_id'])->toArray(); } diff --git a/app/Transformers/Api/Application/UserTransformer.php b/app/Transformers/Api/Application/UserTransformer.php index ae0712c9a..ddec17e82 100644 --- a/app/Transformers/Api/Application/UserTransformer.php +++ b/app/Transformers/Api/Application/UserTransformer.php @@ -37,7 +37,8 @@ class UserTransformer extends BaseTransformer 'last_name' => $user->name_last, 'language' => $user->language, 'root_admin' => (bool) $user->root_admin, - '2fa' => (bool) $user->use_totp, + '2fa_enabled' => (bool) $user->use_totp, + '2fa' => (bool) $user->use_totp, // deprecated, use "2fa_enabled" 'created_at' => $this->formatTimestamp($user->created_at), 'updated_at' => $this->formatTimestamp($user->updated_at), ]; diff --git a/app/Transformers/Api/Client/AccountTransformer.php b/app/Transformers/Api/Client/AccountTransformer.php deleted file mode 100644 index 87689a674..000000000 --- a/app/Transformers/Api/Client/AccountTransformer.php +++ /dev/null @@ -1,32 +0,0 @@ - $model->id, - 'admin' => $model->root_admin, - 'username' => $model->username, - 'email' => $model->email, - 'first_name' => $model->name_first, - 'last_name' => $model->name_last, - 'language' => $model->language, - ]; - } -} diff --git a/app/Transformers/Api/Client/UserTransformer.php b/app/Transformers/Api/Client/UserTransformer.php index c16d7f692..6b42ae507 100644 --- a/app/Transformers/Api/Client/UserTransformer.php +++ b/app/Transformers/Api/Client/UserTransformer.php @@ -19,15 +19,21 @@ class UserTransformer extends BaseClientTransformer * Transforms a User model into a representation that can be shown to regular * users of the API. */ - public function transform(User $model): array + public function transform(User $user): array { return [ - 'uuid' => $model->uuid, - 'username' => $model->username, - 'email' => $model->email, - 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($model->email)), - '2fa_enabled' => $model->use_totp, - 'created_at' => $model->created_at->toAtomString(), + 'uuid' => $user->uuid, + 'username' => $user->username, + 'email' => $user->email, + 'first_name' => $user->name_first, + 'last_name' => $user->name_last, + 'language' => $user->language, + 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)), // deprecated + 'admin' => (bool) $user->root_admin, // deprecated, use "root_admin" + 'root_admin' => (bool) $user->root_admin, + '2fa_enabled' => (bool) $user->use_totp, + 'created_at' => $this->formatTimestamp($user->created_at), + 'updated_at' => $this->formatTimestamp($user->updated_at), ]; } } diff --git a/resources/views/templates/wrapper.blade.php b/resources/views/templates/wrapper.blade.php index 8e52dc80c..aba562c47 100644 --- a/resources/views/templates/wrapper.blade.php +++ b/resources/views/templates/wrapper.blade.php @@ -17,7 +17,7 @@ @section('user-data') @if(!is_null(Auth::user())) @endif @if(!empty($siteConfiguration)) diff --git a/tests/Integration/Api/Application/Users/UserControllerTest.php b/tests/Integration/Api/Application/Users/UserControllerTest.php index 56887fc3d..b52c1c2c6 100644 --- a/tests/Integration/Api/Application/Users/UserControllerTest.php +++ b/tests/Integration/Api/Application/Users/UserControllerTest.php @@ -24,8 +24,8 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase $response->assertJsonStructure([ 'object', 'data' => [ - ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']], - ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa', 'created_at', 'updated_at']], + ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa_enabled', '2fa', 'created_at', 'updated_at']], + ['object', 'attributes' => ['id', 'external_id', 'uuid', 'username', 'email', 'first_name', 'last_name', 'language', 'root_admin', '2fa_enabled', '2fa', 'created_at', 'updated_at']], ], 'meta' => ['pagination' => ['total', 'count', 'per_page', 'current_page', 'total_pages']], ]); @@ -56,6 +56,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase 'last_name' => $this->getApiUser()->name_last, 'language' => $this->getApiUser()->language, 'root_admin' => $this->getApiUser()->root_admin, + '2fa_enabled' => (bool) $this->getApiUser()->totp_enabled, '2fa' => (bool) $this->getApiUser()->totp_enabled, 'created_at' => $this->formatTimestamp($this->getApiUser()->created_at), 'updated_at' => $this->formatTimestamp($this->getApiUser()->updated_at), @@ -73,6 +74,7 @@ class UserControllerTest extends ApplicationApiIntegrationTestCase 'last_name' => $user->name_last, 'language' => $user->language, 'root_admin' => (bool) $user->root_admin, + '2fa_enabled' => (bool) $user->totp_enabled, '2fa' => (bool) $user->totp_enabled, 'created_at' => $this->formatTimestamp($user->created_at), 'updated_at' => $this->formatTimestamp($user->updated_at), diff --git a/tests/Integration/Api/Client/AccountControllerTest.php b/tests/Integration/Api/Client/AccountControllerTest.php index aaca0da0b..ccca6818d 100644 --- a/tests/Integration/Api/Client/AccountControllerTest.php +++ b/tests/Integration/Api/Client/AccountControllerTest.php @@ -22,13 +22,18 @@ class AccountControllerTest extends ClientApiIntegrationTestCase $response->assertOk()->assertJson([ 'object' => 'user', 'attributes' => [ - 'id' => $user->id, - 'admin' => false, + 'uuid' => $user->uuid, 'username' => $user->username, 'email' => $user->email, 'first_name' => $user->name_first, 'last_name' => $user->name_last, - 'language' => $user->language, + 'language' => 'en', + 'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)), + 'admin' => false, + 'root_admin' => false, + '2fa_enabled' => false, + 'created_at' => $this->formatTimestamp($user->created_at), + 'updated_at' => $this->formatTimestamp($user->updated_at), ], ]); } From e08cbdecd4d309abbe2ce698a7a0e4eb9d0d0f7b Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:52:52 +0200 Subject: [PATCH 21/26] Update EnvironmentWriterTrait to allow empty string in CLI (#421) --- app/Traits/Commands/EnvironmentWriterTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Traits/Commands/EnvironmentWriterTrait.php b/app/Traits/Commands/EnvironmentWriterTrait.php index cb7162f97..eb40f8c8b 100644 --- a/app/Traits/Commands/EnvironmentWriterTrait.php +++ b/app/Traits/Commands/EnvironmentWriterTrait.php @@ -33,7 +33,7 @@ trait EnvironmentWriterTrait $saveContents = file_get_contents($path); collect($values)->each(function ($value, $key) use (&$saveContents) { $key = strtoupper($key); - $saveValue = sprintf('%s=%s', $key, $this->escapeEnvironmentValue($value)); + $saveValue = sprintf('%s=%s', $key, $this->escapeEnvironmentValue($value ?? '')); if (preg_match_all('/^' . $key . '=(.*)$/m', $saveContents) < 1) { $saveContents = $saveContents . PHP_EOL . $saveValue; From 5290b8f8bb440ed38fa4c54298c430de1dcfca32 Mon Sep 17 00:00:00 2001 From: MartinOscar <40749467+RMartinOscar@users.noreply.github.com> Date: Tue, 25 Jun 2024 03:41:42 +0200 Subject: [PATCH 22/26] Update ListUsers Prevent bulkdelete of yourself/last admin (#425) * Update ListUsers.php * Update ListUsers.php * Update app/Filament/Resources/UserResource/Pages/ListUsers.php --------- Co-authored-by: Lance Pioch --- app/Filament/Resources/UserResource/Pages/ListUsers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Resources/UserResource/Pages/ListUsers.php b/app/Filament/Resources/UserResource/Pages/ListUsers.php index 89d53de6b..42dc17fab 100644 --- a/app/Filament/Resources/UserResource/Pages/ListUsers.php +++ b/app/Filament/Resources/UserResource/Pages/ListUsers.php @@ -66,7 +66,7 @@ class ListUsers extends ListRecords ->actions([ Tables\Actions\EditAction::make(), ]) - ->checkIfRecordIsSelectableUsing(fn (User $user) => !$user->servers_count) + ->checkIfRecordIsSelectableUsing(fn (User $user) => auth()->user()->id !== $user->id && !$user->servers_count) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), From f459987458871c5fd165f43240b204fdd2e145c1 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 25 Jun 2024 15:37:12 -0400 Subject: [PATCH 23/26] Allow manual (force) updates to eggs (#427) * Update labels * Add force imports * Not multiple * pint + changes --------- Co-authored-by: Charles --- .../Resources/EggResource/Pages/EditEgg.php | 91 ++++++++++++++++++- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/app/Filament/Resources/EggResource/Pages/EditEgg.php b/app/Filament/Resources/EggResource/Pages/EditEgg.php index 9e87ec97b..74a8cfced 100644 --- a/app/Filament/Resources/EggResource/Pages/EditEgg.php +++ b/app/Filament/Resources/EggResource/Pages/EditEgg.php @@ -4,7 +4,11 @@ namespace App\Filament\Resources\EggResource\Pages; use App\Filament\Resources\EggResource; use App\Models\Egg; +use App\Services\Eggs\Sharing\EggImporterService; +use Exception; use Filament\Actions; +use Filament\Forms\Components\Tabs; +use Filament\Notifications\Notification; use Filament\Resources\Pages\EditRecord; use AbdelhamidErrahmouni\FilamentMonacoEditor\MonacoEditor; use App\Services\Eggs\Sharing\EggExporterService; @@ -199,20 +203,97 @@ class EditEgg extends EditRecord protected function getHeaderActions(): array { return [ - Actions\DeleteAction::make() + Actions\DeleteAction::make('deleteEgg') ->disabled(fn (Egg $egg): bool => $egg->servers()->count() > 0) - ->label(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? 'Delete Egg' : 'Egg In Use'), - Actions\Action::make('export') - ->icon('tabler-download') - ->label('Export Egg') + ->label(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? 'Delete' : 'In Use'), + + Actions\Action::make('exportEgg') + ->label('Export') ->color('primary') ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { echo $service->handle($egg->id); }, 'egg-' . $egg->getKebabName() . '.json')), + + Actions\Action::make('importEgg') + ->label('Import') + ->form([ + Forms\Components\Placeholder::make('warning') + ->label('This will overwrite the current egg to the one you upload.'), + Tabs::make('Tabs') + ->tabs([ + Tabs\Tab::make('From File') + ->icon('tabler-file-upload') + ->schema([ + Forms\Components\FileUpload::make('egg') + ->label('Egg') + ->hint('eg. minecraft.json') + ->acceptedFileTypes(['application/json']) + ->storeFiles(false), + ]), + Tabs\Tab::make('From URL') + ->icon('tabler-world-upload') + ->schema([ + Forms\Components\TextInput::make('url') + ->label('URL') + ->hint('Link to the egg file (eg. minecraft.json)') + ->url(), + ]), + ]) + ->contained(false), + + ]) + ->action(function (array $data, Egg $egg): void { + /** @var EggImporterService $eggImportService */ + $eggImportService = resolve(EggImporterService::class); + + if (!empty($data['egg'])) { + try { + $eggImportService->fromFile($data['egg'], $egg); + } catch (Exception $exception) { + Notification::make() + ->title('Import Failed') + ->body($exception->getMessage()) + ->danger() + ->send(); + + report($exception); + + return; + } + } + + if (!empty($data['url'])) { + try { + $eggImportService->fromUrl($data['url'], $egg); + } catch (Exception $exception) { + Notification::make() + ->title('Import Failed') + ->body($exception->getMessage()) + ->danger() + ->send(); + + report($exception); + + return; + } + } + + $this->refreshForm(); + Notification::make() + ->title('Import Success') + ->success() + ->send(); + }), + $this->getSaveFormAction()->formId('form'), ]; } + public function refreshForm(): void + { + $this->fillForm(); + } + protected function getFormActions(): array { return []; From fc92a87993d92e3c7a53cb5c4f2987b887e71161 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Wed, 26 Jun 2024 00:42:55 +0200 Subject: [PATCH 24/26] Add connection test to database hosts (#410) * add connection test to database hosts * fix phpstan --- .../Pages/CreateDatabaseHost.php | 25 ++++++++++++++++++- .../Pages/EditDatabaseHost.php | 24 ++++++++++++++++++ .../Databases/Hosts/HostCreationService.php | 4 +-- .../Databases/Hosts/HostUpdateService.php | 13 ++++++---- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php index e33066539..ccf14a71b 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php @@ -3,10 +3,14 @@ namespace App\Filament\Resources\DatabaseHostResource\Pages; use App\Filament\Resources\DatabaseHostResource; +use App\Services\Databases\Hosts\HostCreationService; use Filament\Resources\Pages\CreateRecord; use Filament\Forms; use Filament\Forms\Components\Section; use Filament\Forms\Form; +use Filament\Notifications\Notification; +use Illuminate\Database\Eloquent\Model; +use PDOException; class CreateDatabaseHost extends CreateRecord { @@ -79,11 +83,30 @@ class CreateDatabaseHost extends CreateRecord return [ $this->getCreateFormAction()->formId('form'), ]; - } + protected function getFormActions(): array { return []; } + protected function handleRecordCreation(array $data): Model + { + return resolve(HostCreationService::class)->handle($data); + } + + public function exception($e, $stopPropagation): void + { + if ($e instanceof PDOException) { + Notification::make() + ->title('Error connecting to database host') + ->body($e->getMessage()) + ->color('danger') + ->icon('tabler-database') + ->danger() + ->send(); + + $stopPropagation(); + } + } } diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php index 16a3ec5a1..1a8b375b3 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php @@ -4,11 +4,15 @@ namespace App\Filament\Resources\DatabaseHostResource\Pages; use App\Filament\Resources\DatabaseHostResource; use App\Models\DatabaseHost; +use App\Services\Databases\Hosts\HostUpdateService; use Filament\Actions; use Filament\Resources\Pages\EditRecord; use Filament\Forms; use Filament\Forms\Components\Section; use Filament\Forms\Form; +use Filament\Notifications\Notification; +use Illuminate\Database\Eloquent\Model; +use PDOException; class EditDatabaseHost extends EditRecord { @@ -90,4 +94,24 @@ class EditDatabaseHost extends EditRecord DatabaseHostResource\RelationManagers\DatabasesRelationManager::class, ]; } + + protected function handleRecordUpdate($record, array $data): Model + { + return resolve(HostUpdateService::class)->handle($record->id, $data); + } + + public function exception($e, $stopPropagation): void + { + if ($e instanceof PDOException) { + Notification::make() + ->title('Error connecting to database host') + ->body($e->getMessage()) + ->color('danger') + ->icon('tabler-database') + ->danger() + ->send(); + + $stopPropagation(); + } + } } diff --git a/app/Services/Databases/Hosts/HostCreationService.php b/app/Services/Databases/Hosts/HostCreationService.php index dd9479aec..da61bbe7a 100644 --- a/app/Services/Databases/Hosts/HostCreationService.php +++ b/app/Services/Databases/Hosts/HostCreationService.php @@ -33,13 +33,13 @@ class HostCreationService 'host' => array_get($data, 'host'), 'port' => array_get($data, 'port'), 'username' => array_get($data, 'username'), - 'max_databases' => null, + 'max_databases' => array_get($data, 'max_databases'), 'node_id' => array_get($data, 'node_id'), ]); // Confirm access using the provided credentials before saving data. $this->dynamic->set('dynamic', $host); - $this->databaseManager->connection('dynamic')->select('SELECT 1 FROM dual'); + $this->databaseManager->connection('dynamic')->getPdo(); return $host; }); diff --git a/app/Services/Databases/Hosts/HostUpdateService.php b/app/Services/Databases/Hosts/HostUpdateService.php index d4975cae0..82f4574e7 100644 --- a/app/Services/Databases/Hosts/HostUpdateService.php +++ b/app/Services/Databases/Hosts/HostUpdateService.php @@ -24,18 +24,21 @@ class HostUpdateService * * @throws \Throwable */ - public function handle(int $hostId, array $data): DatabaseHost + public function handle(DatabaseHost|int $host, array $data): DatabaseHost { + if (!$host instanceof DatabaseHost) { + $host = DatabaseHost::query()->findOrFail($host); + } + if (empty(array_get($data, 'password'))) { unset($data['password']); } - return $this->connection->transaction(function () use ($data, $hostId) { - /** @var DatabaseHost $host */ - $host = DatabaseHost::query()->findOrFail($hostId); + return $this->connection->transaction(function () use ($data, $host) { $host->update($data); + $this->dynamic->set('dynamic', $host); - $this->databaseManager->connection('dynamic')->select('SELECT 1 FROM dual'); + $this->databaseManager->connection('dynamic')->getPdo(); return $host; }); From cf37994c3b3cdc6a9641eb354ced18ae7e866a19 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 25 Jun 2024 20:17:08 -0400 Subject: [PATCH 25/26] Allow user to switch time zones (#332) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Description not required * Overwrite to use user’s time zone * Allow users to change time zones * Update app/Filament/Resources/UserResource/Pages/EditProfile.php Co-authored-by: Boy132 * Pint fix --------- Co-authored-by: Charles Co-authored-by: Boy132 --- .../UserResource/Pages/EditProfile.php | 9 +++++ app/Models/Model.php | 35 +++++++++++++++++++ app/Models/User.php | 1 + .../2024_06_04_212155_add_timezone_column.php | 28 +++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 database/migrations/2024_06_04_212155_add_timezone_column.php diff --git a/app/Filament/Resources/UserResource/Pages/EditProfile.php b/app/Filament/Resources/UserResource/Pages/EditProfile.php index c8ce603a5..6dceac4e2 100644 --- a/app/Filament/Resources/UserResource/Pages/EditProfile.php +++ b/app/Filament/Resources/UserResource/Pages/EditProfile.php @@ -13,6 +13,7 @@ use chillerlan\QRCode\Common\EccLevel; use chillerlan\QRCode\Common\Version; use chillerlan\QRCode\QRCode; use chillerlan\QRCode\QROptions; +use DateTimeZone; use Filament\Forms\Components\Actions\Action; use Filament\Forms\Components\Grid; use Filament\Forms\Components\Placeholder; @@ -85,6 +86,12 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile ->visible(fn (Get $get): bool => filled($get('password'))) ->dehydrated(false), + Select::make('timezone') + ->required() + ->prefixIcon('tabler-clock-pin') + ->options(fn () => collect(DateTimeZone::listIdentifiers())->mapWithKeys(fn ($tz) => [$tz => $tz])) + ->searchable(), + Select::make('language') ->label(trans('strings.language')) ->required() @@ -193,8 +200,10 @@ class EditProfile extends \Filament\Pages\Auth\EditProfile ->schema([ Grid::make('asdf')->columns(5)->schema([ Section::make('Create API Key')->columnSpan(3)->schema([ + TextInput::make('description') ->live(), + TagsInput::make('allowed_ips') ->live() ->splitKeys([',', ' ', 'Tab']) diff --git a/app/Models/Model.php b/app/Models/Model.php index 6846dfd42..536edf9b5 100644 --- a/app/Models/Model.php +++ b/app/Models/Model.php @@ -2,7 +2,11 @@ namespace App\Models; +use Carbon\CarbonInterface; +use DateTimeInterface; use Illuminate\Support\Arr; +use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Date; use Illuminate\Support\Str; use Illuminate\Validation\Rule; use Illuminate\Container\Container; @@ -12,6 +16,7 @@ use App\Exceptions\Model\DataValidationException; use Illuminate\Database\Eloquent\Model as IlluminateModel; use Illuminate\Validation\Factory as ValidationFactory; use Illuminate\Validation\Validator; +use InvalidArgumentException; abstract class Model extends IlluminateModel { @@ -64,6 +69,36 @@ abstract class Model extends IlluminateModel return 'uuid'; } + protected function asDateTime($value) + { + $timezone = auth()->user()?->timezone ?? config('app.timezone', 'UTC'); + + if ($value instanceof CarbonInterface) { + return Date::instance($value->timezone($timezone)); + } + + if ($value instanceof DateTimeInterface) { + return Date::parse($value->format('Y-m-d H:i:s.u'), $timezone); + } + + if (is_numeric($value)) { + return Date::createFromTimestamp($value, $timezone); + } + + if ($this->isStandardDateFormat($value)) { + return Date::instance(Carbon::createFromFormat('Y-m-d', $value)->timezone($timezone)->startOfDay()); + } + + $format = $this->getDateFormat(); + try { + $date = Date::createFromFormat($format, $value)->timezone($timezone); + } catch (InvalidArgumentException) { + $date = false; + } + + return $date ?: Date::parse($value); + } + /** * Returns the validator instance used by this model. */ diff --git a/app/Models/User.php b/app/Models/User.php index c3acfbb46..6639a6a79 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -123,6 +123,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac 'name_last', 'password', 'language', + 'timezone', 'use_totp', 'totp_secret', 'totp_authenticated_at', diff --git a/database/migrations/2024_06_04_212155_add_timezone_column.php b/database/migrations/2024_06_04_212155_add_timezone_column.php new file mode 100644 index 000000000..f5a2bb137 --- /dev/null +++ b/database/migrations/2024_06_04_212155_add_timezone_column.php @@ -0,0 +1,28 @@ +string('timezone')->default('UTC')->after('language'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('timezone'); + }); + } +}; From efb834c8f7aa8f864c870883358ae53c1b96c316 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Tue, 25 Jun 2024 20:30:06 -0400 Subject: [PATCH 26/26] Combine Server states and statuses and resolve #362 (#417) * Simplify states and statuses and resolve #362 # Conflicts: # app/Models/Server.php * Move Random button... Moves button to the info tab --------- Co-authored-by: notCharles --- app/Enums/ContainerStatus.php | 3 + .../ServerResource/Pages/EditServer.php | 84 ++++++------------- .../ServerResource/Pages/ListServers.php | 23 +---- app/Models/Server.php | 44 +++++++++- 4 files changed, 75 insertions(+), 79 deletions(-) diff --git a/app/Enums/ContainerStatus.php b/app/Enums/ContainerStatus.php index ba9effa64..b3b57d2b0 100644 --- a/app/Enums/ContainerStatus.php +++ b/app/Enums/ContainerStatus.php @@ -12,6 +12,7 @@ enum ContainerStatus: string case Paused = 'paused'; case Dead = 'dead'; case Removing = 'removing'; + case Offline = 'offline'; // HTTP Based case Missing = 'missing'; @@ -27,6 +28,7 @@ enum ContainerStatus: string self::Dead => 'tabler-heart-x', self::Removing => 'tabler-heart-down', self::Missing => 'tabler-heart-question', + self::Offline => 'tabler-heart-bolt', }; } @@ -41,6 +43,7 @@ enum ContainerStatus: string self::Dead => 'danger', self::Removing => 'warning', self::Missing => 'danger', + self::Offline => 'gray', }; } } diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index a32928b58..3a18664e8 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -20,7 +20,6 @@ use App\Enums\ServerState; use App\Models\Egg; use App\Models\Server; use App\Models\ServerVariable; -use App\Repositories\Daemon\DaemonServerRepository; use App\Services\Servers\ServerDeletionService; use Filament\Forms\Components\Tabs; use Filament\Forms\Form; @@ -44,55 +43,6 @@ class EditServer extends EditRecord 'lg' => 4, ]) ->schema([ - Forms\Components\ToggleButtons::make('docker') - ->label('Container Status')->inline()->inlineLabel() - ->formatStateUsing(function ($state, Server $server) { - if ($server->node_id === null) { - return 'unknown'; - } - - /** @var DaemonServerRepository $service */ - $service = resolve(DaemonServerRepository::class); - $details = $service->setServer($server)->getDetails(); - - return $details['state'] ?? 'unknown'; - }) - ->options(fn ($state) => collect(ContainerStatus::cases())->filter(fn ($containerStatus) => $containerStatus->value === $state)->mapWithKeys( - fn (ContainerStatus $state) => [$state->value => str($state->value)->replace('_', ' ')->ucwords()] - )) - ->colors(collect(ContainerStatus::cases())->mapWithKeys( - fn (ContainerStatus $status) => [$status->value => $status->color()] - )) - ->icons(collect(ContainerStatus::cases())->mapWithKeys( - fn (ContainerStatus $status) => [$status->value => $status->icon()] - )) - ->columnSpan([ - 'default' => 1, - 'sm' => 2, - 'md' => 2, - 'lg' => 2, - ]), - - Forms\Components\ToggleButtons::make('status') - ->label('Server State')->inline()->inlineLabel() - ->helperText('') - ->formatStateUsing(fn ($state) => $state ?? ServerState::Normal) - ->options(fn ($state) => collect(ServerState::cases())->filter(fn ($serverState) => $serverState->value === $state)->mapWithKeys( - fn (ServerState $state) => [$state->value => str($state->value)->replace('_', ' ')->ucwords()] - )) - ->colors(collect(ServerState::cases())->mapWithKeys( - fn (ServerState $state) => [$state->value => $state->color()] - )) - ->icons(collect(ServerState::cases())->mapWithKeys( - fn (ServerState $state) => [$state->value => $state->icon()] - )) - ->columnSpan([ - 'default' => 1, - 'sm' => 2, - 'md' => 2, - 'lg' => 2, - ]), - Tabs::make('Tabs') ->persistTabInQueryString() ->columnSpan(6) @@ -121,7 +71,7 @@ class EditServer extends EditRecord })) ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, 'lg' => 3, ]) @@ -133,15 +83,35 @@ class EditServer extends EditRecord ->label('Owner') ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, - 'lg' => 3, + 'lg' => 2, ]) ->relationship('user', 'username') ->searchable() ->preload() ->required(), + Forms\Components\ToggleButtons::make('condition') + ->label('Server Status') + ->formatStateUsing(fn (Server $server) => $server->condition) + ->options(fn ($state) => collect(array_merge(ContainerStatus::cases(), ServerState::cases())) + ->filter(fn ($condition) => $condition->value === $state) + ->mapWithKeys(fn ($state) => [$state->value => str($state->value)->replace('_', ' ')->ucwords()]) + ) + ->colors(collect(array_merge(ContainerStatus::cases(), ServerState::cases()))->mapWithKeys( + fn ($status) => [$status->value => $status->color()] + )) + ->icons(collect(array_merge(ContainerStatus::cases(), ServerState::cases()))->mapWithKeys( + fn ($status) => [$status->value => $status->icon()] + )) + ->columnSpan([ + 'default' => 2, + 'sm' => 1, + 'md' => 1, + 'lg' => 1, + ]), + Forms\Components\Textarea::make('description') ->label('Description') ->columnSpanFull(), @@ -150,7 +120,7 @@ class EditServer extends EditRecord ->hintAction(CopyAction::make()) ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, 'lg' => 3, ]) @@ -160,7 +130,7 @@ class EditServer extends EditRecord ->hintAction(CopyAction::make()) ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, 'lg' => 3, ]) @@ -169,7 +139,7 @@ class EditServer extends EditRecord ->label('External ID') ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, 'lg' => 3, ]) @@ -179,7 +149,7 @@ class EditServer extends EditRecord ->relationship('node', 'name') ->columnSpan([ 'default' => 2, - 'sm' => 2, + 'sm' => 1, 'md' => 2, 'lg' => 3, ]) diff --git a/app/Filament/Resources/ServerResource/Pages/ListServers.php b/app/Filament/Resources/ServerResource/Pages/ListServers.php index 0d28c23fc..bd0f1fa21 100644 --- a/app/Filament/Resources/ServerResource/Pages/ListServers.php +++ b/app/Filament/Resources/ServerResource/Pages/ListServers.php @@ -26,28 +26,11 @@ class ListServers extends ListRecords Group::make('egg.name')->getDescriptionFromRecordUsing(fn (Server $server): string => str($server->egg->description)->limit(150)), ]) ->columns([ - Tables\Columns\TextColumn::make('status') + Tables\Columns\TextColumn::make('condition') ->default('unknown') ->badge() - ->default(fn (Server $server) => $server->status ?? $server->retrieveStatus()) - ->icon(fn ($state) => match ($state) { - 'node_fail' => 'tabler-server-off', - 'running' => 'tabler-heartbeat', - 'removing' => 'tabler-heart-x', - 'offline' => 'tabler-heart-off', - 'paused' => 'tabler-heart-pause', - 'installing' => 'tabler-heart-bolt', - 'suspended' => 'tabler-heart-cancel', - default => 'tabler-heart-question', - }) - ->color(fn ($state): string => match ($state) { - 'running' => 'success', - 'installing', 'restarting' => 'primary', - 'paused', 'removing' => 'warning', - 'node_fail', 'install_failed', 'suspended' => 'danger', - default => 'gray', - }), - + ->icon(fn (Server $server) => $server->conditionIcon()) + ->color(fn (Server $server) => $server->conditionColor()), Tables\Columns\TextColumn::make('uuid') ->hidden() ->label('UUID') diff --git a/app/Models/Server.php b/app/Models/Server.php index adb5ab98e..a0c341c6d 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -2,9 +2,11 @@ namespace App\Models; +use App\Enums\ContainerStatus; use App\Enums\ServerState; use App\Exceptions\Http\Connection\DaemonConnectionException; use GuzzleHttp\Exception\GuzzleException; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Notifications\Notifiable; use Illuminate\Database\Query\JoinClause; @@ -69,7 +71,6 @@ use App\Exceptions\Http\Server\ServerStateConflictException; * @property \App\Models\User $user * @property \Illuminate\Database\Eloquent\Collection|\App\Models\EggVariable[] $variables * @property int|null $variables_count - * * @method static \Database\Factories\ServerFactory factory(...$parameters) * @method static \Illuminate\Database\Eloquent\Builder|Server newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Server newQuery() @@ -100,7 +101,17 @@ use App\Exceptions\Http\Server\ServerStateConflictException; * @method static \Illuminate\Database\Eloquent\Builder|Server whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Server whereUuid($value) * @method static \Illuminate\Database\Eloquent\Builder|Server whereuuid_short($value) - * + * @property array|null $docker_labels + * @property string|null $ports + * @property-read mixed $condition + * @property-read \Illuminate\Database\Eloquent\Collection $eggVariables + * @property-read int|null $egg_variables_count + * @property-read \Illuminate\Database\Eloquent\Collection $serverVariables + * @property-read int|null $server_variables_count + * @method static \Illuminate\Database\Eloquent\Builder|Server whereDockerLabels($value) + * @method static \Illuminate\Database\Eloquent\Builder|Server whereInstalledAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|Server wherePorts($value) + * @method static \Illuminate\Database\Eloquent\Builder|Server whereUuidShort($value) * @mixin \Eloquent */ class Server extends Model @@ -410,4 +421,33 @@ class Server extends Model return cache()->get("servers.$this->uuid.container.status") ?? 'missing'; } + + public function condition(): Attribute + { + return Attribute::make( + get: fn () => $this->status?->value ?? $this->retrieveStatus(), + ); + } + + public function conditionIcon(): string + { + if ($this->status === null) { + $containerStatus = ContainerStatus::from($this->retrieveStatus()); + + return $containerStatus->icon(); + } + + return $this->status->icon(); + } + + public function conditionColor(): string + { + if ($this->status === null) { + $containerStatus = ContainerStatus::from($this->retrieveStatus()); + + return $containerStatus->color(); + } + + return $this->status->color(); + } }