Search
 
SCRIPT & CODE EXAMPLE
 

PHP

disable foreign key laravel

//...
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();
    }
    //...
}
Comment

larael drop foreign key

Schema::table('posts', function (Blueprint $table) {
	$table->dropForeign(['category_id']);
});
Comment

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');
});
Comment

laravel remove foreign key

$table->dropForeign('posts_user_id_foreign');
Comment

laravel drop foreign key

// Primary table name, from Schema::table(<table>)
// Primary column, from $table->foreign(<column>)
$table->dropForeign('<table>_<column>_foreign');
Comment

PREVIOUS NEXT
Code Example
Php :: php timezone for manila 
Php :: php switch 
Php :: How to install php-fpm 
Php :: larael drop foreign key 
Php :: phpstorm serial key 2020.2.3 
Php :: laravel collection flatten 
Php :: wp max revisions 
Php :: magento 2 get connection 
Php :: get acf repeater field 
Php :: cast array to object php 
Php :: php date + 1 year 
Php :: laravel make migration controller resource mcr 
Php :: string to float php 
Php :: laravel getbindings 
Php :: check session in blade laravel 
Php :: php datetime object get unix timestamp 
Php :: get_posts category 
Php :: php artisan migrate reset 
Php :: laravel get public path url 
Php :: php create temporary file 
Php :: php text colors 
Php :: transaction in laravel 
Php :: logout in laravel 8 
Php :: php bbcode tag dellete 
Php :: regex for email php 
Php :: php header 500 
Php :: windows wsl php 8 
Php :: repeater acf 
Php :: phph get server protocol 
Php :: php array of objects filter 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =