I'm using migrations to change a field to nullable(), using the following code.

$table->integer('recipe_id')->nullable()->change();

But I'm getting the following error.

SQLSTATE[HY000]: General error: 1025 Error on rename of './blackfisk/#sql-2 2d_a' to './blackfisk/preparations' (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: ALTER TABLE preparations CHANGE recipe_id recipe _id INT DEFAULT NULL)

I've tried setting the foreign key checks to 0 using

\DB::statement('SET FOREIGN_KEY_CHECKS=0');

But it's giving the same error. When I try to run the query in Sequel Pro I also get this error, using the following query.

SET FOREIGN_KEY_CHECKS = 0; ALTER TABLE preparations CHANGE recipe_id recipe_id INT DEFAULT NULL; SET FOREIGN_KEY_CHECKS = 1;

Any idea If I'm missing something here? Thank you!