Module: Mihari::Commands::Database

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

Overview

Database sub-commands

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



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

def included(thor)
  thor.class_eval do
    include Concerns::DatabaseConnectable

    desc "migrate", "Migrate DB schemas"
    around :with_db_connection
    method_option :verbose, type: :boolean, default: true
    #
    # @param [String] direction
    #
    def migrate(direction = "up")
      ActiveRecord::Migration.verbose = options["verbose"]
      Mihari::Database.migrate direction.to_sym
    end
  end
end