mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
add indexes so counting topics and posts is faster
This commit is contained in:
parent
fcbc77d0cd
commit
204759a3ea
|
@ -0,0 +1,14 @@
|
|||
class AddUserIndexesToPostsAndTopics < ActiveRecord::Migration
|
||||
def up
|
||||
execute "CREATE INDEX idx_posts_user_id_deleted_at
|
||||
ON posts(user_id) WHERE deleted_at IS NULL"
|
||||
|
||||
execute "CREATE INDEX idx_topics_user_id_deleted_at
|
||||
ON topics(user_id) WHERE deleted_at IS NULL"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "DROP INDEX idx_posts_user_id_deleted_at"
|
||||
execute "DROP INDEX idx_topics_user_id_deleted_at"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user