Class: Migr8::Actions::RedoAction

Inherits:
Action
  • Object
show all
Defined in:
lib/migr8.rb

Constant Summary collapse

NAME =
"redo"
DESC =
"do migration down, and up it again"
OPTS =
[
  "-n N  : redo N migrations",
  "--ALL : redo all migrations",
]
ARGS =
nil

Instance Method Summary collapse

Methods inherited from Action

#cmdopterr, find_by_name, #get_command, inherited, #parse, #parser, #repository, #short_usage, subclasses, #usage

Instance Method Details

#run(options, args) ⇒ Object



1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
# File 'lib/migr8.rb', line 1757

def run(options, args)
  n = 1
  if options['n']
    n = options['n'].to_i
  elsif options['ALL']
    n = nil
  end
  #
  op = RepositoryOperation.new(repository())
  _wrap do
    op.downgrade(n)
    op.upgrade(n)
  end
end