假如你的資料庫版本較舊,若執行php artisan make:migrate時,則會出現1071Specified key was too long 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_unique`(`email`))
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
解決方法:
在app\Providers\AppServiceProvider.php再boot()方法中加上預設值
Schema::defaultStringLength(191);
沒有留言:
張貼留言