Class: Migr8::Actions::UnapplyAction

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

Constant Summary collapse

NAME =
"unapply"
DESC =
"unapply specified migrations"
OPTS =
["-x:  unapply versions with down-script in DB, not in file"]
ARGS =
"version ..."

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



1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
# File 'lib/migr8.rb', line 1802

def run(options, args)
  only_in_db = options['x']
  ! args.empty?  or
    raise cmdopterr("#{NAME}: version required.")
  #
  versions = args
  repo = repository()
  op = RepositoryOperation.new(repo)
  _wrap do
    if only_in_db
      op.unapply_only_in_database(versions)
    else
      op.unapply(versions)
    end
  end
end