“Upuść migrację laravel z kolumną” Kod odpowiedzi

migracja laravel usuń kolumnę

public function up()
{
  Schema::table('table', function($table) {
    $table->dropColumn('column_name');
  });
}
Faithful Fish

Kolumna Laravel Drop

// To drop a column, use the dropColumn method on the schema builder.
// Before dropping columns from a SQLite database, you will need to add
// the doctrine/dbal dependency to your composer.json file and run the
// composer update command in your terminal to install the library:

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

Laravel z upuszczeniem migracji kolumnowej

 Class RemoveCommentViewCount extends Migration
  {
      public function up()
      {
          Schema::table('articles', function($table) {
             $table->dropColumn('comment_count');
             $table->dropColumn('view_count');
          });
      }

      public function down()
      {
          Schema::table('articles', function($table) {
             $table->integer('comment_count');
             $table->integer('view_count');
          });
      }
  }
Lazy Book

Upuść tabelę kolumny w migracji, jeśli istnieje w Laravel

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

Laravel Migracja Usuń kolumnę

Class RemoveCommentViewCount extends Migration
  {
      public function up()
      {
          Schema::table('table', function($table) {
             $table->dropColumn('coulmn_name');
          });
      }

      public function down()
      {
          Schema::table('table', function($table) {
             $table->integer('column_name');
          });
      }
  }
Muhammad Kaleem

Upuść migrację laravel z kolumną

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

Odpowiedzi podobne do “Upuść migrację laravel z kolumną”

Pytania podobne do “Upuść migrację laravel z kolumną”

Więcej pokrewnych odpowiedzi na “Upuść migrację laravel z kolumną” w PHP

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu