Sha256: e0fd08018e4e74bcbc853e72877571007a0a2d08e296dde8f0f7a023e51a4f80

Contents?: true

Size: 933 Bytes

Versions: 7

Compression:

Stored size: 933 Bytes

Contents

require 'eucalypt/eucalypt-migration/namespaces/migration-change/generators/column'
require 'eucalypt/helpers'
require 'eucalypt/errors'

module Eucalypt
  class MigrationChange < Thor
    include Eucalypt::Helpers
    using Colorize
    option :options, aliases: '-o', type: :hash, default: {}, enum: %w[limit default null precision scale], desc: "Column options"
    desc "column [TABLE] [COLUMN] [TYPE]", "Changes a column's type definition".colorize(:grey)
    def column(table, column, type)
      directory = File.expand_path('.')
      if Eucalypt.app? directory
        return unless Eucalypt::Helpers::Migration::Validation.valid_type? type
        migration = Eucalypt::Generators::Change::Column.new
        migration.destination_root = directory
        migration.generate(table: table, column: column, type: type, options: options[:options])
      else
        Eucalypt::Error.wrong_directory
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
eucalypt-0.2.2 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.2.1 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.2.0 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.1.3 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.1.2 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.1.1 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb
eucalypt-0.1.0 lib/eucalypt/eucalypt-migration/namespaces/migration-change/cli/change-column.rb