Increase slug size#183
Conversation
|
This seems to conflict with Laravel 5.4 using the default usage of utf8mb4. I get a SQLSTATE 42000 error when running the migrations. I believe indexed fields can’t be longer than 191 characters. |
|
@mtveerman That kind of sucks. The problem with this field is that it needs to be indexed because it is used when checking the permissions in SQL queries and could be potential bottleneck if used at a scale. I suggest two ways for solving this issue:
Pros/cons for 1st case: [+] Forces user to split permission slugs into smaller groups Pros/cons for 2nd case: [+] Any amount of slug rules |
|
And what if we change the column type from |
|
@mtveerman That would be almost same as
as stated from manual. |
|
@konovalov-nk Right.... Maybe a more dramatic option would be to create a separate table for slug, related to the permission. This would allow for indexing, since there is one record per slug. |
This commit increases initial value for
slugfield inpermissionstable and adds an exception when JSON representation ofslugfields exceeds 1024 characters.The reason for that is permission rules are stored as a JSON string and when user assign too many rules to permission it would give him a DB error without any description what happened.