“migration de colonne de dépôt Laravel” Réponses codées

Laravel Migration Retirez la colonne

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

Colonne 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

migration de colonne de dépôt Laravel

 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

Tableau de colonne de dépose dans la migration s'il existe à Laravel

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

Colonne de table Laravel Drop Table

Update Table

migrate:fresh          Drop all tables and re-run all migrations
migrate:install        Create the migration repository
migrate:refresh        Reset and re-run all migrations
migrate:reset          Rollback all database migrations
migrate:rollback       Rollback the last database migration
migrate:status         Show the status of each migration

for specific table
php artisan migrate:refresh --path=/database/migrations/table_name.php
Engineer Wajid Ali

Laravel Migration Supprimer la colonne

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

Réponses similaires à “migration de colonne de dépôt Laravel”

Questions similaires à “migration de colonne de dépôt Laravel”

Plus de réponses similaires à “migration de colonne de dépôt Laravel” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code