add index for bulletin without create_indexes

This commit is contained in:
chiu 2021-08-18 11:40:18 +08:00
parent a27d1818f5
commit 577a845e1f
1 changed files with 2 additions and 0 deletions

View File

@ -85,6 +85,8 @@ class Bulletin
scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)}
before_create :set_expire
before_save :check_limit
index({postdate: 1}, { unique: false, background: true })
index({is_top: -1,postdate: -1, _id: -1}, { unique: false, background: true })
def to_calendar_param
self.to_param
end