Class: LazyMigrate::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/lazy_migrate/client.rb

Constant Summary collapse

MIGRATE =
'migrate'
ROLLBACK =
'rollback'
UP =
'up'
DOWN =
'down'
REDO =
'redo'
BRING_TO_TOP =
'bring to top'

Class Method Summary collapse

Class Method Details

.runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lazy_migrate/client.rb', line 19

def run
  migrator_adapter = MigratorAdapterFactory.create_migrator_adapter

  loop do
    catch(:done) do
      on_done = -> { throw :done }

      prompt.ok("\nDatabase: #{ActiveRecord::Base.connection_config[:database]}\n")

      select_migration_prompt(on_done: on_done, migrator_adapter: migrator_adapter)
    end
  end
rescue TTY::Reader::InputInterrupt
  puts
end