Home > Article > PHP Framework > What should I do if an error occurs in the Larabel migration file?
The tutorial column of Laravel below will introduce to you the solution to the SQLSTATE[42000] error when migrating files in Larabel. I hope it will be helpful to everyone!
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 `users` add unique `users_email_unique`(`email`))
<?php namespace App\Providers;use Illuminate\Support\ServiceProvider;use Illuminate\Support\Facades\Schema;class AppServiceProvider extends ServiceProvider{ public function register() { } public function boot() { Schema::defaultStringLength(191); }}
Schema::defaultStringLength(191);
Related recommendations: The latest five Laravel video tutorials
The above is the detailed content of What should I do if an error occurs in the Larabel migration file?. For more information, please follow other related articles on the PHP Chinese website!