Track how many posts a user reads each day in user_visits

This commit is contained in:
Neil Lalonde
2014-01-24 15:19:20 -05:00
parent aada592b5b
commit 7cc5da08fe
6 changed files with 56 additions and 7 deletions

View File

@@ -0,0 +1,12 @@
class AddPostsReadToUserVisits < ActiveRecord::Migration
def up
add_column :user_visits, :posts_read, :integer, default: 0
# Can't accurately back-fill this column. Assume everyone read at least one post per visit.
execute "UPDATE user_visits SET posts_read = 1"
end
def down
remove_column :user_visits, :posts_read
end
end