laravel / ideas

Issues board used for Laravel internals discussions.
939 stars 28 forks source link

[Proposal] dropColumnIfExists() #1749

Open joisarjignesh opened 5 years ago

joisarjignesh commented 5 years ago

if we want to drop column if exists in table laravel migration

now we are using like that

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

it's better use like that directly

   Schema::table('tableName', function (Blueprint $table) {
          $table->dropColumnIfExists('columnName');
   });
ManojKiranA commented 5 years ago

pretty clear

salamwaddah commented 5 years ago

I want this.