mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
8 lines
332 B
Ruby
8 lines
332 B
Ruby
|
class AddRepliesToForumThreads < ActiveRecord::Migration
|
||
|
def change
|
||
|
add_column :forum_threads, :reply_count, :integer, default: 0, null: false
|
||
|
|
||
|
execute "UPDATE forum_threads SET reply_count = (SELECT COUNT(*) FROM posts WHERE posts.reply_to_post_number IS NOT NULL AND posts.forum_thread_id = forum_threads.id)"
|
||
|
end
|
||
|
end
|