FEATURE: Editor badge

This commit is contained in:
Sam
2014-07-07 17:55:25 +10:00
parent ee3f7362e6
commit 0f25bbeaf7
8 changed files with 72 additions and 12 deletions

View File

@@ -0,0 +1,12 @@
class AddSelfEditsToPosts < ActiveRecord::Migration
def up
add_column :posts, :self_edits, :integer, null: false, default: 0
execute "
UPDATE posts p SET self_edits = (SELECT COUNT(*) FROM post_revisions pr WHERE pr.post_id = p.id AND pr.user_id=p.user_id)
"
end
def down
remove_column :posts, :self_edits
end
end