Method: Mongo::Migration#update
- Defined in:
- lib/mongo/migration/migration.rb
#update(version = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mongo/migration/migration.rb', line 13 def update version = nil version ||= definitions.keys.max version = version.to_i if current_version == version info "database '#{db.name}' already is of #{version} version, no migration needed" return false else info "updating '#{db.name}' to #{version}" end increase_db_version while current_version < version decrease_db_version while current_version > version true end |