Created
March 26, 2012 14:39
-
-
Save DiveInto/2205555 to your computer and use it in GitHub Desktop.
how to add index using rails migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddIndexToFavourites < ActiveRecord::Migration | |
def self.up | |
add_index :favourites,[:user_id,:sell_info_id],:unique => true | |
end | |
def self.down | |
remove_index :favourites,[:user_id,:sell_info_id] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment