Class: RedshiftSimpleMigrator::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/redshift_simple_migrator/cli.rb

Instance Method Summary collapse

Instance Method Details

#list(version = nil) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/redshift_simple_migrator/cli.rb', line 17

def list(version = nil)
  with_migrator do |m|
    direction, migrations = m.run_migrations(version)
    migrations.each do |migration|
      puts "#{direction} #{migration.version} #{migration.class.to_s}"
    end
  end
end

#migrate(version = nil) ⇒ Object



29
30
31
32
33
# File 'lib/redshift_simple_migrator/cli.rb', line 29

def migrate(version = nil)
  with_migrator do |m|
    m.run(version)
  end
end

#versionObject



7
8
9
10
11
12
# File 'lib/redshift_simple_migrator/cli.rb', line 7

def version
  with_migrator do |m|
    current_version = m.current_version
    puts "Current version is #{current_version}"
  end
end