Class: ElasticsearchRecord::SchemaMigration

Inherits:
ActiveRecord::SchemaMigration
  • Object
show all
Defined in:
lib/elasticsearch_record/schema_migration.rb

Instance Method Summary collapse

Instance Method Details

#table_nameObject



8
9
10
# File 'lib/elasticsearch_record/schema_migration.rb', line 8

def table_name
  "#{ElasticsearchRecord::Base.table_name_prefix}#{ElasticsearchRecord::Base.schema_migrations_table_name}#{ElasticsearchRecord::Base.table_name_suffix}"
end

#versionsObject

overwrite method to fix the default limit (= 10) to support returning more than 10 migrations



13
14
15
16
17
18
19
20
# File 'lib/elasticsearch_record/schema_migration.rb', line 13

def versions
  sm = Arel::SelectManager.new(arel_table)
  sm.project(arel_table[primary_key])
  sm.order(arel_table[primary_key].asc)
  sm.take(connection.max_result_window(table_name))

  connection.select_values(sm, "#{self.class} Load")
end