What's the correct syntax for remove_index in a Rails 3.1.0 migration?

后端 未结 6 968
清歌不尽
清歌不尽 2021-02-01 00:30

I\'m in the process of adding Devise to an existing Rails app, with a Users table already defined. The devise generator pushed out the following migration:

class         


        
6条回答
  •  滥情空心
    2021-02-01 00:54

    Depending on the database type, you don't need to worry about removing the indexes in the self.down method since the index will automatically be removed from the database when you drop the column.

    You can also use this syntax in your self.down method:

    def self.down
       remove_column :users, :email
       remove_column :users, :encrypted_password
       remove_column :users, :reset_password_token
    end
    

提交回复
热议问题