且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Laravel迁移中删除外键

更新时间:2023-11-17 18:30:46

在所有> 4.0版本的Laravel中,它允许将列名放入数组中,然后数组将自行解析.我试图找到随附的文档,但他们似乎已将其遗漏了.

In all of the >4.0 versions of Laravel, it allows placing column names into an array, which it will then resolve on its own. I tried to find accompanying docs, but they seem to have left it out.

在更新迁移中,尝试以下操作:

In your update migration, try this:

Schema::table('role_user', function (Blueprint $table) {
  $table->dropForeign(['user_id']);
  $table->dropForeign(['role_id']);
});