Drop Column Table In Migration If Exist In Laravel

[Solved] Drop Column Table In Migration If Exist In Laravel | Php - Code Explorer | yomemimo.com
Question : laravel drop column if exists

Answered by : lovely-llama-lpft77abt2tl

if (Schema::hasColumn('users', 'phone')) {	Schema::table('users', function (Blueprint $table){ $table->dropColumn('phone'); });
}

Source : | Last Update : Fri, 20 Nov 20

Question : laravel drop column if exists

Answered by : elated-eel-pe6rs9be8w6q

Schema::table('users', function (Blueprint $table) { $table->dropColumn('name');
});

Source : | Last Update : Thu, 24 Sep 20

Question : drop column table in migration if exist in laravel

Answered by : mohamad-shahkhajeh

Schema::table('users', function (Blueprint $table) { if (Schema::hasColumn('users', 'phone')) { $table->dropColumn('phone');	}
});

Source : | Last Update : Wed, 11 Aug 21

Question : drop column laravel migration

Answered by : yousef-qaoud

Schema::table('clients', function (Blueprint $table) { $table->string('UserDomainName');
});

Source : https://stackoverflow.com/questions/45819718/laravel-migrations-dropping-columns | Last Update : Thu, 19 May 22

Answers related to drop column table in migration if exist in laravel

Code Explorer Popular Question For Php