Skip to content

Instantly share code, notes, and snippets.

@caike
Created January 22, 2011 00:51
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 caike/790726 to your computer and use it in GitHub Desktop.
Save caike/790726 to your computer and use it in GitHub Desktop.
class AddIndexesToTables < ActiveRecord::Migration
def self.up
add_index :tweets, :user_id
add_index :tweets, :tweet_id
add_index :tweets, :created_at
add_index :users, :email, :unique => true
add_index :account_settings, :user_id
end
def self.down
remove_index :tweets, :user_id
remove_index :tweets, :tweet_id
remove_index :tweets, :created_at
remove_index :tweets, :email
remove_index :account_settings, :user_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment