1.마이그레이션 파일을 작성한다.

1
php artisan  make:migration drop_posts_tag_id_colum
cs


2. 스키마를 작성한다. posts = 테이블명, tag_id = 삭제할 컬럼

1
2
3
4
5
6
    public function up()
    {
        Schema::table('posts', function (Blueprint $table) {
            $table->dropColumn('tag_id');
        });
    }
cs


3. 마이그레이션실행한다.

php artisan migrate


컬럼이 삭제된것을 확인 할 수 있다.



+ Recent posts