Method: DBGeni::MigrationCLI#rollback_until_migration
- Defined in:
- lib/dbgeni/migration_cli.rb
#rollback_until_migration(migration_name, force = nil) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/dbgeni/migration_cli.rb', line 116 def rollback_until_migration(migration_name, force=nil) ensure_initialized milestone = find_migration(migration_name) applied = applied_and_broken_migrations.reverse index = applied.index milestone unless index # milestone migration doesn't exist or is already applied. raise DBGeni::MigrationNotApplied, milestone.to_s end # Note the triple ... in the range to exclude the end element # This is because we don't want to rollback the final migration as its upto but not including apply_migration_list(applied[0...index], force, false) end |