Jo Micheal
Published in : 2022-01-20
SQLSTATE[42000]: Syntax error or access violation:1071 Specified key was too long; max key length is 767 bytes (SQL: alter table "users add unique users email_unique' ('email') )
I get this error when i try to run the migration using
php artisan migrate
what should I do to figure out this Error?
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now
Joseph Morgan Date : 2022-01-20
Best answers
11
Best answers
11
that's because the defaultStringLength is not setup, you need to limit it from /app/Providers/AppServiceProvider.php
using the Schema
so the file should looks like
I imported the schema using use Illuminate\Support\Facades\Schema;
then added Schema::defaultStringLength(191); into the boot function
Let me know if this worked with you
Jo Micheal Date : 2022-01-20
Thanks, this was the issue, when i updated the file like this it worked fine