Will removing a column with a Rails migration remove indexes associated with the column

前端 未结 6 883
一个人的身影
一个人的身影 2021-01-07 15:46

In Rails 2, will removing a column with a Rails migration also change/remove indexes associated with the column? If not, and instead you have to also change/remove each ind

6条回答
  •  梦谈多话
    2021-01-07 16:39

    To clarify, inside a migration the syntax to remove a 2 column index is the following

    remove_index :actions, :column => [:user_id,:action_name]
    

    or by name, a worse option from my point of view

    remove_index :actions, :name => "index_actions_on_user_id_and_action_name"
    

提交回复
热议问题