Skip to content
Advertisement

How can drop colum in table

Is this query is correct?

I’m using Laravel 8, and I want to drop a column in a table. But this query isn’t working.

php artisan make:migration remove_contact_no_from_customer --table=customer

Advertisement

Answer

you should use To drop a column, you may use the dropColumn method on the schema builder blueprint:

first, you can create a migration file:

php artisan make:migration remove_contact_no_from_customer --table=customer

then, in that migration, make sure you code will be:

 Schema::table('customer', function (Blueprint $table) {
            $table->dropColumn('contact_no');
        });
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement