Question:
I am trying to migrate a users table in Laravel. When I run my migration I get this error:
[Illuminate\Database\QueryException] 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_uniq(
Solution:
to fix this issue just edit your AppServiceProvider.php file and inside the boot method set a default string length like this:
use Illuminate\Database\Schema\Builder;
public function boot()
{
Builder::defaultStringLength(191);
}