Laravel Migrations - Dropping columns
The down
function is used for rollbacks, you have to add this dropColumn
in the up
function because it is an action you want to perform when running migrations.
So, in your up
function there should be:
Schema::table('clients', function (Blueprint $table) { $table->dropColumn('UserDomainName');});
And in the down
function you should do the inverse, add the column back:
Schema::table('clients', function (Blueprint $table) { $table->string('UserDomainName');});
This way, you can always return to any point in the migrations.
To dropColumn , You can do like this
In your down function there should be:
public function down() { Schema::table('products', function (Blueprint $table) { $table->dropColumn('UserDomainName'); }); }
Then runphp artisan migrate:rollback
That's it.