How to drop columns using Rails migration

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

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

20条回答
  •  心在旅途
    2020-12-12 09:35

    To remove the column from table you have to run following migration:

    rails g migration remove_column_name_from_table_name column_name:data_type
    

    Then run command:

    rake db:migrate
    

提交回复
热议问题