Sha256: 01398d46c4ddb616f7a51ec8a2b1f8d3ca11b3f26224fd9a5f5f839abe2336da

Contents?: true

Size: 781 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
eucalypt-0.2.2 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb
eucalypt-0.2.1 lib/eucalypt/eucalypt-migration/namespaces/migration-drop/cli/drop-index.rb