Specified Key Too Long Fix
Specified Key Too Long Fix
Fix the annoying migration error "Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes "

This is an annoying problem but really easy to solve. You just need to set the default length of a string in migration to 191.

Simply open app\Providers\AppServiceProvider.php

add the following to the top:

use Illuminate\Support\Facades\Schema;

and then within the boot function (probably blank)  add:

Schema::defaultStringLength(191);


Thanks it!

What's your reaction?

Comments

https://www.magazine.tdbcomputing.com/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!

Facebook Conversations

Disqus Conversations