【发布时间】:2019-10-31 16:16:25
【问题描述】:
完整性约束违规:1451 无法删除或更新父行:外键约束失败
users Table
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
cv table
Schema::create('cvs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->string('name')->nullable();
$table->string('contact')->nullable();
$table->string('contact2')->nullable();
$table->string('gender')->nullable();
$table->string('email')->unique()->nullable();
$table->string('paddress')->nullable();
});
【问题讨论】:
标签: laravel