Class: ActiveGroonga::SchemaManagementTable
- Inherits:
-
Object
- Object
- ActiveGroonga::SchemaManagementTable
- Defined in:
- lib/active_groonga/migrator.rb
Constant Summary
- TABLE_NAME =
"schema_migrations"
Instance Method Summary (collapse)
- - (Object) current_version
-
- (SchemaManagementTable) initialize
constructor
A new instance of SchemaManagementTable.
- - (Object) migrated_versions
- - (Object) remove_version(version)
- - (Object) update_version(version)
Constructor Details
- (SchemaManagementTable) initialize
Returns a new instance of SchemaManagementTable
47 48 49 50 |
# File 'lib/active_groonga/migrator.rb', line 47 def initialize ensure_table @table = Base.context[TABLE_NAME] end |
Instance Method Details
- (Object) current_version
52 53 54 |
# File 'lib/active_groonga/migrator.rb', line 52 def current_version @current_version ||= (migrated_versions.last || [0]).first end |
- (Object) migrated_versions
56 57 58 59 60 61 62 |
# 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 |
- (Object) remove_version(version)
69 70 71 72 |
# File 'lib/active_groonga/migrator.rb', line 69 def remove_version(version) @table[version].delete clear_cache end |
- (Object) update_version(version)
64 65 66 67 |
# File 'lib/active_groonga/migrator.rb', line 64 def update_version(version) @table.add(version, :migrated_at => Time.now) clear_cache end |