Module: Mihari::Commands::Database

Includes:
Mixins::Database
Included in:
Mihari::CLI::Database
Defined in:
lib/mihari/commands/database.rb

Class Method Summary collapse

Methods included from Mixins::Database

#with_db_connection

Class Method Details

.included(thor) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mihari/commands/database.rb', line 8

def self.included(thor)
  thor.class_eval do
    desc "migrate", "Migrate DB schemas"
    method_option :verbose, type: :boolean, default: true
    #
    # @param [String] direction
    #
    #
    def migrate(direction = "up")
      verbose = options["verbose"]
      ActiveRecord::Migration.verbose = verbose

      with_db_connection do
        Mihari::Database.migrate(direction.to_sym)
      end
    end
  end
end