class ActiveGroonga::SchemaManagementTable
Constants
- TABLE_NAME
Public Class Methods
new()
click to toggle source
# File lib/active_groonga/migrator.rb, line 47 def initialize ensure_table @table = Base.context[TABLE_NAME] end
Public Instance Methods
current_version()
click to toggle source
# File lib/active_groonga/migrator.rb, line 52 def current_version @current_version ||= (migrated_versions.last || [0]).first end
migrated_versions()
click to toggle source
# File lib/active_groonga/migrator.rb, line 56 def migrated_versions @migrated_versions ||= @table.collect do |record| [record.key, record.migrated_at] end.sort_by do |version, migrated_at| version end end
remove_version(version)
click to toggle source
# File lib/active_groonga/migrator.rb, line 69 def remove_version(version) @table[version].delete clear_cache end
update_version(version)
click to toggle source
# File lib/active_groonga/migrator.rb, line 64 def update_version(version) @table.add(version, :migrated_at => Time.now) clear_cache end
Private Instance Methods
clear_cache()
click to toggle source
# File lib/active_groonga/migrator.rb, line 85 def clear_cache @current_version = nil @migrated_versions = nil end
ensure_table()
click to toggle source
# File lib/active_groonga/migrator.rb, line 75 def ensure_table Schema.define do |schema| schema.create_table(TABLE_NAME, :type => :hash, :key_type => "UInt64") do |table| table.time("migrated_at") end end end