mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
add indexes so counting topics and posts is faster
This commit is contained in:
@ -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
|
Reference in New Issue
Block a user