Class: Ardb::Runner::MigrateCommand
- Inherits:
-
Object
- Object
- Ardb::Runner::MigrateCommand
- Defined in:
- lib/ardb/runner/migrate_command.rb
Instance Method Summary collapse
-
#initialize(out_io = nil, err_io = nil) ⇒ MigrateCommand
constructor
A new instance of MigrateCommand.
- #run ⇒ Object
Constructor Details
#initialize(out_io = nil, err_io = nil) ⇒ MigrateCommand
Returns a new instance of MigrateCommand.
7 8 9 10 11 |
# File 'lib/ardb/runner/migrate_command.rb', line 7 def initialize(out_io = nil, err_io = nil) @out_io = out_io || $stdout @err_io = err_io || $stderr @adapter = Ardb::Adapter.send(Ardb.config.db.adapter) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ardb/runner/migrate_command.rb', line 13 def run begin Ardb.init @adapter.migrate_db @adapter.dump_schema unless ENV['ARDB_MIGRATE_NO_SCHEMA'] rescue Ardb::Runner::CmdError => e raise e rescue StandardError => e @err_io.puts "error migrating #{Ardb.config.db.database.inspect} database" @err_io.puts e @err_io.puts e.backtrace raise Ardb::Runner::CmdFail end end |