Skip to content

Instantly share code, notes, and snippets.

@mickey
Created April 4, 2012 23:16
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 mickey/2306479 to your computer and use it in GitHub Desktop.
Save mickey/2306479 to your computer and use it in GitHub Desktop.
class CreateActivities < ActiveRecord::Migration
def self.up
create_table :activities do |t|
t.integer :user_id, :null => false
t.integer :activity_type, :null => false
t.integer :target_id, :null => false
t.string :target_type, :null => false
t.timestamps
end
add_index :activities, [:target_id, :target_type]
add_index :activities, :user_id
end
def self.down
drop_table :activities
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment