I have user_id fk column in my table
$table->foreign('user_id')->references('id')->on('users');
I should add on cascade delete feature to this existing column. How can I do this?
Drop foreign key first. Thanks to Razor for this tip
$table->dropForeign('answers_user_id_foreign'); $table->foreign('user_id') ->references('id')->on('users') ->onDelete('cascade');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With