# Error creating dynamic roles and permissions

**URL:** <https://forum.radsystems.io/t/error-creating-dynamic-roles-and-permissions/319>\
**Category:** Bugs\
**Created:** [June 12, 2021, 9:53pm UTC](https://forum.radsystems.io/t/error-creating-dynamic-roles-and-permissions/319 "2021-06-12T21:53:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mramanolo](https://forum.radsystems.io/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@mramanolo](https://forum.radsystems.io/u/mramanolo)\
**Post date:** [June 12, 2021, 9:53pm UTC](https://forum.radsystems.io/t/error-creating-dynamic-roles-and-permissions/319/1 "2021-06-12T21:53:09Z")

</div>

In the new version 3.7 when trying to add roles and dynamic permissions the following error is generated:

Migrating: 2020\_10\_15\_000000\_create\_roles\_permissions\_tables

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `model_has_permissions` add index `model_has_permissions_model_id_model_type_index`(`model_id`, `model_type`))

at F:\Project\beta\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671  
667| // If an exception occurs when attempting to run a query, we’ll format the error  
668| // message to include the bindings with SQL, which will make this exception a  
669| // lot more helpful to the developer instead of just the database’s errors.  
670| catch (Exception $e) {

> 671| throw new QueryException(  
> 672| $query, $this-\>prepareBindings($bindings), $e  
> 673| );  
> 674| }  
> 675|

1 F:\Project\beta\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464  
PDOException::(“SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes”)

2 F:\Project\beta\vendor\laravel\framework\src\Illuminate\Database\Connection.php:464  
PDOStatement::execute()

Windows 10, Laragon 5.0, php 7.4.19, mysql 5.7.33

---

<div class="post-metadata">

**Author:** ![willvin](https://forum.radsystems.io/user_avatar/forum.radsystems.io/willvin/32/7_2.png) [@willvin](https://forum.radsystems.io/u/willvin)\
**Post date:** [June 16, 2021, 11:50am UTC](https://forum.radsystems.io/t/error-creating-dynamic-roles-and-permissions/319/2 "2021-06-16T11:50:49Z")

</div>

A post was merged into an existing topic: [User Authentication Problem](https://forum.radsystems.io/t/user-authentication-problem/296)

---

<div class="post-metadata">

**Author:** ![willvin](https://forum.radsystems.io/user_avatar/forum.radsystems.io/willvin/32/7_2.png) [@willvin](https://forum.radsystems.io/u/willvin)\
**Post date:** [June 16, 2021, 11:50am UTC](https://forum.radsystems.io/t/error-creating-dynamic-roles-and-permissions/319/3 "2021-06-16T11:50:49Z")

</div>


