Sha256: a25e44678ee4b0aaac899bd28b4c9dcf8694bf80591606d379b703436f77aef0

Contents?: true

Size: 781 Bytes

Versions: 5

Compression:

Stored size: 781 Bytes

Contents

require 'eucalypt/eucalypt-migration/namespaces/migration-drop/generators/index'
require 'eucalypt/app'
require 'eucalypt/errors'
require 'eucalypt/helpers'

module Eucalypt
  class MigrationDrop < Thor
    include Eucalypt::Helpers
    using Colorize
    option :name, aliases: '-n', type: :string, desc: "Index name"
    desc "index [TABLE] [*COLUMNS]", "Removes an index from a table".colorize(:grey)
    def index(table, *columns)
      directory = File.expand_path('.')
      if Eucalypt.app? directory
        migration = Eucalypt::Generators::Drop::Index.new
        migration.destination_root = directory
        migration.generate(table: table, columns: columns, name: options[:name]||'index')
      else
        Eucalypt::Error.wrong_directory
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eucalypt-0.2.0 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb
eucalypt-0.1.3 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb
eucalypt-0.1.2 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb
eucalypt-0.1.1 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb
eucalypt-0.1.0 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb