“Laravel Migration Excluir coluna” Respostas de código

Migração de Laravel Remover coluna

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

reversão de migração de Laravel

To rollback one step:

php artisan migrate:rollback

To rollback multiple steps:

php artisan migrate:rollback --step=[x]
  
To drop all tables and reload all migrations:

php artisan migrate:fresh
Angry Albatross

coluna 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 de migração de colunas de soltar

 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

Laravel Migration Excluir coluna

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

Migração Laravel Drop Keys estrangeiros

$table->dropPrimary('users_id_primary');
Open Octopus

Respostas semelhantes a “Laravel Migration Excluir coluna”

Perguntas semelhantes a “Laravel Migration Excluir coluna”

Mais respostas relacionadas para “Laravel Migration Excluir coluna” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código