Skip to content

Instantly share code, notes, and snippets.

@DiveInto
Created March 26, 2012 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiveInto/2205555 to your computer and use it in GitHub Desktop.
Save DiveInto/2205555 to your computer and use it in GitHub Desktop.
how to add index using rails migration
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