目前我的关系船舶是:
$table->integer('facility_id')->unsigned()->nullable();
$table->foreign('facility_id')->references('id')->on('facility')->onDelete('cascade');
这是在设施表上,现在我想在新迁移中更改表,我要删除fk并在新表中添加fk
$table->dropForeign(['facility_id']);
$table->foreign('facility_id')->references('facility_locations_id')->on('facility_locations')->onDelete('cascade');
我只是更改表名,但显示为
annot add or update a child row: a foreign key constraint
fails (`ovadaclinic_fd_dev`.`#sql-7d54_31`, CONSTRAINT
`user_facility_facility_id_fore
ign` FOREIGN KEY (`facility_id`) REFERENCES `facility_locations`
(`facility_locations_id`) ON DELETE CASCADE) (SQL: alter table
`user_facility` add constraint `user_facility_facility_id_foreign` fore
ign key (`facility_id`) references `facility_locations`
(`facility_locations_id`) on delete cascade)
我该如何解决这个问题? 非常感谢您的帮助