以下是迁移代码:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('first_name');
$table->string('last_name');
$table->text('bio');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('profile_picture');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}发布于 2020-12-08 20:03:07
迁移对您得到的错误的影响较小。这是因为在这一点上,错误指示rbuckridge@example.com已经存在于用户表中。这是通过->unique()方法实现的,该方法防止在相同的表列中重复输入相同的数据。
我的建议是先清空表格中的所有数据,然后重新输入邮件或使用其他邮件。
https://stackoverflow.com/questions/65198106
复制相似问题