laravel Specified key was too long 解决方案

来源:互联网 发布:有趣的工作 知乎 编辑:程序博客网 时间:2024/05/29 13:25

参考地址 https://laravel.com/docs/master/migrations#creating-indexes

http://www.cnblogs.com/betx/p/6544090.html


解决办法:

Index Lengths & MySQL / MariaDB

Laravel uses the utf8mb4 character set by default, which includes support for storing "emojis" in the database. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually configure the default string length generated by migrations in order for MySQL to create indexes for them. You may configure this by calling theSchema::defaultStringLength method within your AppServiceProvider:

use Illuminate\Support\Facades\Schema;/** * Bootstrap any application services. * * @return void */public function boot(){    Schema::defaultStringLength(191);}


1 0
原创粉丝点击