laravel drop database migration code example
Example 1: artisan migration rollback
php artisan migrate:rollback
Example 2: drop column migration 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');
});
}
}
Example 3: laravel drop table migration
Schema::drop('users');
Schema::dropIfExists('users');
Example 4: migrate to an existing table in laravel commad
php artisan make:migration add_paid_to_users_table --table=users
Example 5: migrate to an existing table in laravel commad
public function up()
{
Schema::table('users', function($table) {
$table->integer('paid');
});
}