xxxxxxxxxx
// Disable foreign key checks
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
// Your queries here without foreign key checks
// Enable foreign key checks
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
xxxxxxxxxx
//...
class ClearOldOauthRelations extends Migration
{
public function up()
{
Schema::disableForeignKeyConstraints();
// drop foreign keys
Schema::table('oauth_access_tokens', function (BluePrint $table) {
$table->dropForeign('oauth_access_tokens_session_id_foreign');
});
//...
Schema::enableForeignKeyConstraints();
}
//...
}