2013-02-05 13:16:51 -06:00
|
|
|
class CreateActions < ActiveRecord::Migration
|
|
|
|
def change
|
|
|
|
create_table :actions do |t|
|
|
|
|
|
2013-02-25 10:42:20 -06:00
|
|
|
# I elected for multiple ids as opposed to using :as cause it makes the table
|
2013-02-05 13:16:51 -06:00
|
|
|
# thinner, and the joining semantics much simpler (a simple multiple left join will do)
|
|
|
|
#
|
2013-02-25 10:42:20 -06:00
|
|
|
# There is a notificiation table as well that covers much of this,
|
|
|
|
# but this table is wider and is intended for non-notifying actions as well
|
|
|
|
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2013-03-23 10:02:59 -05:00
|
|
|
t.integer :action_type, null: false
|
|
|
|
t.integer :user_id, null: false
|
2013-02-05 13:16:51 -06:00
|
|
|
t.integer :target_forum_thread_id
|
|
|
|
t.integer :target_post_id
|
|
|
|
t.integer :target_user_id
|
|
|
|
t.integer :acting_user_id
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index :actions, [:user_id, :action_type]
|
|
|
|
add_index :actions, [:acting_user_id]
|
|
|
|
end
|
|
|
|
end
|