Comments (7)
So the new settings conflicts with the Laravel's default string length and validations, which is 255. So either we have to update the validations to 125 or ...
I suppose you could bypass calling Schema::defaultStringLength(125)
if you simply impose it in your migration, as shown in the migration stub comments:
You would still have to manually impose your own validation rules (including length limits) on any forms you create to manage those fields, as usual in any application.
from laravel-permission.
But my point is that the migrations works fine with MySQL 8.0 without setting the default string length as 125 or updating the migrations, when using InnoDB with dynamic or compressed row format in MySQL. So what I'm trying to say is as per the prerequisites documentation and the migration stub comments, it's kind of misleading that if I'm using MySQL 8.0, it's mandatory to update the string limit to 125 either globally or just for the permission and roles table.
from laravel-permission.
Right. I'm digging to collect enough information in order to convey the requirements as accurately as possible, without making the documentation extra-long.
I guess perhaps the simplest approach is to explain what environments/configurations require special care to avoid triggering errors caused by limitations within said environments.
from laravel-permission.
Another thought: What's the actual max length "needed" for guard_name
? Do people really need to accommodate 255 or 125 character guard names? Most applications I've seen use 3 chars ('web', 'api', etc) or maybe 5 ("admin").
I wonder if we hard-code it to 25 maybe that will give a happy combination?
eg, default in the migration to:
$table->string('guard_name', 25);
from laravel-permission.
Or ... what's the way to query MySQL for the max index length the current db host supports for a given table?
Maybe we can query that in the migration and dynamically set things accordingly?
from laravel-permission.
I couldn't find any query to get the configuration. But as you might already know, the engine and row format can be obtained from the information schema. Maybe that details can be used to set a custom configuration.
SELECT TABLE_NAME, ENGINE, ROW_FORMAT FROM information_schema.TABLES where TABLE_SCHEMA = 'schema_name_from_env' AND TABLE_NAME = 'migrations'
In my opinion, it will be easier to mention these in the documentation so that the user can decide which configuration to use. You just need to include the steps to identify the correct configuration.
So if MyISAM - name and guard_name should be 125.
InnoDB REDUNDANT or COMPACT row format - name and guard_name should be 95 // Not sure if my calculation is correct.
Use the default value for InnoDB DYNAMIC or COMPRESSED row format.
Here are some links for reference if that helps.
from laravel-permission.
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
from laravel-permission.
Related Issues (20)
- Access to undeclared static property Spatie\Permission\PermissionRegistrar::$pivotPermission HOT 6
- Access to undeclared static property Spatie\Permission\PermissionRegistrar::$pivotRole HOT 1
- Trait "Spatie\Permission\Traits\HasRoles" not found in app/User.php HOT 10
- php artisan permission:show uuid error HOT 1
- Typo in docs HOT 1
- Base table or view not found: 1146 Table 'role_user' doesn't exist HOT 6
- for v6 - There is no role with ID `org_uuid` for guard `api` HOT 3
- team_id doesn't have a default value HOT 5
- assignRole and syncRoles fail for model with ulid type id HOT 2
- Documentation for v6/main unaccessible at spatie.be HOT 4
- Wrong octane event listener HOT 2
- Too much Role-Models loaded HOT 3
- Enums shouldn't be casted in the model HOT 8
- assignRole > getModel() > null
- Timestamps in migration for sql server HOT 4
- Target class [Spatie\Permission\Middlewares\PermissionMiddleware] does not exist. HOT 2
- DOCS - Side menu dissapeared HOT 4
- Problem upgrading with existing data permissions/roles HOT 1
- Cannot save the user model twice in the same request HOT 10
- withoutPermission scope from HasPermissions returns users from outside the team HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-permission.