0

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table permissions add unique pe rmissions_name_guard_name_unique(name, guard_name))

when migrating I'm getting this error? Help to solve this? Laravel 8 I added Schema::defaultStringLength(191); to AppServiceprovider inside boot() but it is not helping.

faizan.sh
  • 371
  • 3
  • 14
  • 1
    It has nothing to do with "defaultStringLength", use a short name for the foreign key in your migration. – faizan.sh Feb 04 '21 at 07:55
  • it is Laravel Spatie Permission package is it allowed to change? – yunusdjanov Feb 04 '21 at 07:57
  • Does it affect the work process? @faizan.sh – yunusdjanov Feb 04 '21 at 07:58
  • 1
    Does this answer your question? [Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/42244541/laravel-migration-error-syntax-error-or-access-violation-1071-specified-key-wa) – Rouhollah Mazarei Feb 04 '21 at 08:16

1 Answers1

0

You need to reduce the column names