add indexes for better performance
This commit is contained in:
parent
9533df3e43
commit
962c04a615
@ -19,6 +19,9 @@ class ContentType
|
||||
end
|
||||
end
|
||||
|
||||
## indexes ##
|
||||
index [[:site_id, Mongo::ASCENDING], [:slug, Mongo::ASCENDING]]
|
||||
|
||||
## callbacks ##
|
||||
before_validation :normalize_slug
|
||||
before_save :set_default_values
|
||||
|
@ -20,6 +20,11 @@ class Page
|
||||
## associations ##
|
||||
referenced_in :site
|
||||
|
||||
## indexes ##
|
||||
index :site_id
|
||||
index :parent_id
|
||||
index [[:fullpath, Mongo::ASCENDING], [:site_id, Mongo::ASCENDING]]
|
||||
|
||||
## callbacks ##
|
||||
before_validation :normalize_slug
|
||||
before_save { |p| p.fullpath = p.fullpath(true) }
|
||||
|
@ -17,6 +17,9 @@ class Site
|
||||
references_many :content_types, :dependent => :destroy
|
||||
embeds_many :memberships
|
||||
|
||||
## indexes
|
||||
index :domains
|
||||
|
||||
## validations ##
|
||||
validates_presence_of :name, :subdomain
|
||||
validates_uniqueness_of :subdomain
|
||||
|
@ -17,6 +17,10 @@ class ThemeAsset
|
||||
## associations ##
|
||||
referenced_in :site
|
||||
|
||||
## indexes ##
|
||||
index :site_id
|
||||
index [[:content_type, Mongo::ASCENDING], [:slug, Mongo::ASCENDING], [:site_id, Mongo::ASCENDING]]
|
||||
|
||||
## callbacks ##
|
||||
before_validation :sanitize_slug
|
||||
before_validation :store_plain_text
|
||||
|
Loading…
Reference in New Issue
Block a user