How to drop columns using Rails migration

前端 未结 20 765
执笔经年
执笔经年 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

    first try to create a migration file running the command:

    rails g migration RemoveAgeFromUsers age:string
    

    and then on the root directory of the project run the migration running the command:

    rails db:migrate
    

提交回复
热议问题