Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

remove foreign key constraint laravel

Schema::table('table_name', function (Blueprint $table) {
    $table->dropForeign(['foreign_key']);
    $table->dropColumn('column_key');
});

PS: usually foreign_key = column_key

ex: 

Schema::table('despatch_discrepancies', function (Blueprint $table) {
    $table->dropForeign(['pick_detail_id']);
    $table->dropColumn('pick_detail_id');
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #foreign #key #constraint #laravel
ADD COMMENT
Topic
Name
3+5 =