Skip to content

Instantly share code, notes, and snippets.

@kalleth
Created February 6, 2012 09:40
Show Gist options
  • Save kalleth/1751084 to your computer and use it in GitHub Desktop.
Save kalleth/1751084 to your computer and use it in GitHub Desktop.
class CreateLoginRecords < ActiveRecord::Migration
def self.up
create_table :login_records do |t|
t.integer :user_id
t.datetime :logged_in
t.timestamps
end
add_index(:login_records, :user_id)
add_index(:login_records, :logged_in)
end
def self.down
drop_table :login_records
#_should_ remove indexes as well, but if not, you need to remove_index/drop_index/del_index here
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment