1 Class RemoveCommentViewCount extends Migration
2 {
3 public function up()
4 {
5 Schema::table('articles', function($table) {
6 $table->dropColumn('comment_count');
7 $table->dropColumn('view_count');
8 });
9 }
10
11 public function down()
12 {
13 Schema::table('articles', function($table) {
14 $table->integer('comment_count');
15 $table->integer('view_count');
16 });
17 }
18 }
1Comment::where('post_id',$id)->delete();
2
3// in down migration
4
5 public function down()
6 {
7 Schema::table('package_types', function (Blueprint $table) {
8 \App\Models\PackageType::query()->where('id','gt',1)->delete();
9 });
10 }
1// delete a migration safely from laravel
2delete migration from database/migrations/ directory
3and also delete entry from migrations table