Skip to content

Commit

Permalink
Fix varchar(191) by replacing with 255 #135 (#376)
Browse files Browse the repository at this point in the history
* 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 <git@lance.sh>
  • Loading branch information
RMartinOscar and lancepioch committed Jun 16, 2024
1 parent 482e8ed commit aa08e77
Show file tree
Hide file tree
Showing 37 changed files with 958 additions and 663 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function form(Form $form): Form
->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.')
Expand All @@ -57,12 +57,12 @@ public function form(Form $form): Form
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function form(Form $form): Form
->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.')
Expand All @@ -52,12 +52,12 @@ public function form(Form $form): Form
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public function form(Form $form): Form
->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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public function form(Form $form): Form
->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()
Expand Down
14 changes: 7 additions & 7 deletions app/Filament/Resources/EggResource/Pages/CreateEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public function form(Form $form): Form
->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])
Expand Down Expand Up @@ -88,7 +88,7 @@ public function form(Form $form): Form
->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()
Expand Down Expand Up @@ -140,21 +140,21 @@ public function form(Form $form): Form
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())
)
->required(),
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'),
Expand All @@ -173,7 +173,7 @@ public function form(Form $form): Form

Forms\Components\TextInput::make('script_container')
->required()
->maxLength(191)
->maxLength(255)
->default('alpine:3.4'),

Forms\Components\Select::make('script_entry')
Expand Down
16 changes: 8 additions & 8 deletions app/Filament/Resources/EggResource/Pages/EditEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function form(Form $form): Form
->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')
Expand All @@ -42,7 +42,7 @@ public function form(Form $form): Form
->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])
Expand Down Expand Up @@ -95,7 +95,7 @@ public function form(Form $form): Form
->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()
Expand Down Expand Up @@ -143,21 +143,21 @@ public function form(Form $form): Form
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())
)
->required(),
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'),
Expand All @@ -176,12 +176,12 @@ public function form(Form $form): Form

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')
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/MountResource/Pages/CreateMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function form(Form $form): Form
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?')
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/MountResource/Pages/EditMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public function form(Form $form): Form
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?')
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/NodeResource/Pages/CreateNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function form(Forms\Form $form): Forms\Form

$set('dns', false);
})
->maxLength(191),
->maxLength(255),

Forms\Components\TextInput::make('ip')
->disabled()
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/NodeResource/Pages/EditNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function form(Forms\Form $form): Forms\Form

$set('dns', false);
})
->maxLength(191),
->maxLength(255),

Forms\Components\TextInput::make('ip')
->disabled()
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/ServerResource/Pages/CreateServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function form(Form $form): Form
'lg' => 3,
])
->required()
->maxLength(191),
->maxLength(255),

Forms\Components\Select::make('owner_id')
->prefixIcon('tabler-user')
Expand Down Expand Up @@ -403,7 +403,7 @@ public function form(Form $form): Form

$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) {
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/ServerResource/Pages/EditServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function form(Form $form): Form
'lg' => 3,
])
->required()
->maxLength(191),
->maxLength(255),

Forms\Components\Select::make('owner_id')
->prefixIcon('tabler-user')
Expand Down Expand Up @@ -172,7 +172,7 @@ public function form(Form $form): Form
'md' => 2,
'lg' => 3,
])
->maxLength(191),
->maxLength(255),
Forms\Components\Select::make('node_id')
->label('Node')
->relationship('node', 'name')
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/UserResource/Pages/EditProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function getForms(): array
->label(trans('strings.username'))
->disabled()
->readOnly()
->maxLength(191)
->maxLength(255)
->unique(ignoreRecord: true)
->autofocus(),

Expand All @@ -61,7 +61,7 @@ protected function getForms(): array
->label(trans('strings.email'))
->email()
->required()
->maxLength(191)
->maxLength(255)
->unique(ignoreRecord: true),

TextInput::make('password')
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function form(Form $form): Form
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))
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ protected function getHeaderActions(): array
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')
Expand Down
Loading

0 comments on commit aa08e77

Please sign in to comment.