mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Editor badge
This commit is contained in:
12
db/migrate/20140707071913_add_self_edits_to_posts.rb
Normal file
12
db/migrate/20140707071913_add_self_edits_to_posts.rb
Normal 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
|
||||
Reference in New Issue
Block a user