Class: Hanami::Sequel::CLI::Migration

Inherits:
CLI::Command
  • Object
show all
Defined in:
lib/hanami/sequel/commands/migration.rb

Instance Method Summary collapse

Instance Method Details

#call(name:, **options) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/hanami/sequel/commands/migration.rb', line 9

def call(name:, **options)
  now = Time.now.strftime('%Y%m%d%H%M%S')
  name = Utils::String.underscore(name)
  destination = File.join('./',
                          CLI.config.migrations,
                          "#{now}_#{name}.rb")

  CLI.generate(CLI.template('migration'), nil, destination)
end