下面由laravel教程欄目帶大家介紹關(guān)于larabel遷移文件時(shí)報(bào)sqlstate[42000]錯誤的解決方法,希望對大家有所幫助!
Laravel執(zhí)行php artisan migrate命令時(shí),報(bào)如錯誤的解決方法
IlluminateDatabaseQueryException??:? 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`))
解決方法
修改 app/Providers/AppServiceProvider.php文件中添加如下內(nèi)容:
<?php namespace AppProviders;use IlluminateSupportServiceProvider;use IlluminateSupportFacadesSchema;class AppServiceProvider extends ServiceProvider{ public function register() { } public function boot() { Schema::defaultStringLength(191); }}
修改部分
Schema::defaultStringLength(191);
相關(guān)推薦:laravel
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END