diff --git a/app/models/column_entry.rb b/app/models/column_entry.rb index f9e4db0..4da8599 100644 --- a/app/models/column_entry.rb +++ b/app/models/column_entry.rb @@ -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 diff --git a/app/models/table_column.rb b/app/models/table_column.rb index 16fd3d4..f748a5b 100644 --- a/app/models/table_column.rb +++ b/app/models/table_column.rb @@ -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" diff --git a/app/models/table_entry.rb b/app/models/table_entry.rb index 32ed289..18a0de3 100644 --- a/app/models/table_entry.rb +++ b/app/models/table_entry.rb @@ -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