我正在尝试在Laravel中迁移用户表.当我运行迁移时,我收到此错误:
[Illuminate\Database\QueryException] SQLSTATE [42000]:语法错误或访问冲突:1071指定密钥太长; 最大密钥长度为767字节(SQL:alter table
usersadd unique users_email_uniq(
我的迁移如下:
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('name', 32);
$table->string('username', 32);
$table->string('email', 320);
$table->string('password', 64);
$table->string('role', 32);
$table->string('confirmation_code');
$table->boolean('confirmed')->default(true);
$table->timestamps();
$table->unique('email', 'users_email_uniq');
});
Run Code Online (Sandbox Code Playgroud)
经过一些谷歌搜索我遇到了这个错误报告,泰勒说你可以指定索引键作为unique()我做的第二个参数.它仍然给出了错误.这里发生了什么?