module NoBrainer::Document::TableConfig

Constants

VALID_TABLE_CONFIG_OPTIONS

Public Class Methods

drop!() click to toggle source
# File lib/no_brainer/document/table_config.rb, line 119
def drop!
  NoBrainer.run { |r| r.db_drop(NoBrainer.current_db) }
end
purge!() click to toggle source
# File lib/no_brainer/document/table_config.rb, line 123
def purge!
  NoBrainer.run { |r| r.table_list }.each do |table_name|
    # keeping the index meta store because indexes are not going away when purging
    next if table_name == NoBrainer::Document::Index::MetaStore.table_name
    NoBrainer.run { |r| r.table(table_name).delete }
  end
  true
end
rebalance(options={}) click to toggle source
# File lib/no_brainer/document/table_config.rb, line 112
def rebalance(options={})
  NoBrainer.run { |r| r.table_list }.each do |table_name|
    NoBrainer.run { |r| r.table(table_name).rebalance }
  end
  true
end
sync_indexes(options={}) click to toggle source
# File lib/no_brainer/document/table_config.rb, line 101
def sync_indexes(options={})
  # NoBrainer internal models don't have indexes.
  models = NoBrainer::Document.all(:types => [:user])
  NoBrainer::Document::Index::Synchronizer.new(models).sync_indexes(options)
end
sync_schema(options={}) click to toggle source
# File lib/no_brainer/document/table_config.rb, line 107
def sync_schema(options={})
  sync_table_config(options)
  sync_indexes(options)
end
sync_table_config(options={}) click to toggle source
# File lib/no_brainer/document/table_config.rb, line 96
def sync_table_config(options={})
  models = NoBrainer::Document.all(:types => [:user, :nobrainer])
  NoBrainer::Document::TableConfig::Synchronizer.new(models).sync_table_config(options)
end