我正在try 迁移Laravel中的用户表.当我运行迁移时,会出现以下错误:
[照明\数据库\查询异常]SQLSTATE[42000]:语法错误 或访问冲突:1071指定的密钥太长;最大密钥长度 为767字节(SQL:ALTER TABLE
users
ADD 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');
});
在谷歌搜索之后,我发现了this bug report,泰勒说您可以将索引键指定为unique()
的第二个参数,我已经这样做了.它仍然会给出错误.这里发生什么事情?