PERF: speed up counting of unread notifications

This commit is contained in:
Sam 2015-05-14 12:33:43 +10:00
parent e6f73a1c80
commit 1eeed5fed2

View file

@ -0,0 +1,5 @@
class AddUnreadNotificationsIndex < ActiveRecord::Migration
def change
add_index :notifications, [:user_id, :notification_type], where: 'not read', name: 'idx_notifications_speedup_unread_count'
end
end