Answer the question
In order to leave comments, you need to log in
How to add nullable to given field?
First there is such a migration => Tyk
I need to add null to cards.city_id (so that they can be)
Created such a migration
Schema::table('cards', function (Blueprint $table) {
$table->integer('city_id')->nullable()->change();
});
Answer the question
In order to leave comments, you need to log in
Remove the foreign key, then make the field nullable. After that, create the foreign key again.
1.
2. Then make the field nullable.
3. Then againDB::statement('SET FOREIGN_KEY_CHECKS = 0;');
DB::statement('SET FOREIGN_KEY_CHECKS = 1;');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question