Sha256: ee86aa6ead5b5c687811a343a4d50649891edf8667b795c3d16af1b4de329215

Contents?: true

Size: 791 Bytes

Versions: 7

Compression:

Stored size: 791 Bytes

Contents

require 'eucalypt/eucalypt-migration/namespaces/migration-rename/generators/table'
require 'eucalypt/helpers'
require 'eucalypt/errors'

module Eucalypt
  class MigrationRename < Thor
    include Eucalypt::Helpers
    include Eucalypt::Helpers::Messages
    using Colorize

    desc "table [OLD] [NEW]", "Renames a table".colorize(:grey)
    def table(old_name, new_name)
      directory = File.expand_path('.')
      if Eucalypt.app? directory
        Out.warning "This command #{"will not".colorize(:bold)} rename any associated model."
        migration = Eucalypt::Generators::Rename::Table.new
        migration.destination_root = directory
        migration.generate(old_name: old_name, new_name: new_name)
      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-rename/cli/rename-table.rb
eucalypt-0.2.1 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb
eucalypt-0.2.0 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb
eucalypt-0.1.3 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb
eucalypt-0.1.2 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb
eucalypt-0.1.1 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb
eucalypt-0.1.0 lib/eucalypt/eucalypt-migration/namespaces/migration-rename/cli/rename-table.rb