Add indexes.
This commit is contained in:
parent
061447c5d1
commit
99fa506a51
|
@ -11,8 +11,13 @@ class ColumnEntry
|
|||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :table_entry
|
||||
belongs_to :table_column
|
||||
belongs_to :table_entry, :dependent => :destroy, index: true
|
||||
belongs_to :table_column, :dependent => :destroy, index: true
|
||||
|
||||
I18n.available_locales.each do |locale|
|
||||
index({text: 1}, { collation: {locale: locale.to_s}, unique: false, background: true })
|
||||
index({content: 1}, { collation: {locale: locale.to_s}, unique: false, background: true })
|
||||
end
|
||||
|
||||
|
||||
def type
|
||||
|
|
|
@ -12,9 +12,14 @@ class TableColumn
|
|||
field :make_categorizable, type: Boolean, default: false
|
||||
field :default_ordered_field, type: Boolean, default: false
|
||||
field :order_direction,type: String,default: 'desc'
|
||||
belongs_to :u_table
|
||||
belongs_to :u_table, :dependent => :destroy, index: true
|
||||
|
||||
has_many :column_entries
|
||||
|
||||
index({display_in_index: -1}, { unique: false, background: true })
|
||||
index({order: 1}, { unique: false, background: true })
|
||||
index({key: 1}, { unique: false, background: true })
|
||||
|
||||
has_many :column_entries, :dependent => :destroy
|
||||
def sort_hash(direction)
|
||||
case self.type
|
||||
when "text"
|
||||
|
|
|
@ -7,7 +7,7 @@ class TableEntry
|
|||
field :sort_number, type: Integer
|
||||
|
||||
has_many :column_entries, :dependent => :destroy
|
||||
belongs_to :u_table
|
||||
belongs_to :u_table, :dependent => :destroy, index: true
|
||||
|
||||
accepts_nested_attributes_for :column_entries, :allow_destroy => true
|
||||
|
||||
|
|
Loading…
Reference in New Issue