laravel 드롭 열 존재하는 경우
if (Schema::hasColumn('users', 'phone')) {
Schema::table('users', function (Blueprint $table){
$table->dropColumn('phone');
});
}
laravel 체크인 경우 테이블이 열
if (Schema::hasTable('users')) {
// The "users" table exists...
}
if (Schema::hasColumn('users', 'email')) {
// The "users" table exists and has an "email" column...
}
laravel 마이그레이션을 확인하는 경우에는 테이블은 열
// You may check for the existence of a table or column
// using the hasTable and hasColumn methods:
if (Schema::hasTable('users')) {
// The "users" table exists...
}
if (Schema::hasColumn('users', 'email')) {
// The "users" table exists and has an "email" column...
}