How to drop columns using Rails migration

前端 未结 20 754
执笔经年
执笔经年 2020-12-12 08:50

What\'s the syntax for dropping a database table column through a Rails migration?

20条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 09:37

    Give below command it will add in migration file on its own

    rails g migration RemoveColumnFromModel
    

    After running above command you can check migration file remove_column code must be added there on its own

    Then migrate the db

    rake db:migrate
    

提交回复
热议问题