Sha256: bd9fb6a2e1744d3c318a8dc7ac346b498c94434557b81a27dc7f2168bbea5961

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

require 'erb'

module Hanami
  module Sequel
    module CLI
      class Migration < Hanami::CLI::Command
        argument :name, required: true, desc: 'Name of the migration'

        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
      end
    end
  end
end

Hanami::CLI.register 'sequel migration', Hanami::Sequel::CLI::Migration

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-sequel-1.1.1 lib/hanami/sequel/commands/migration.rb
hanami-sequel-1.1.0.1 lib/hanami/sequel/commands/migration.rb