Sha256: 58e3406dbbd643a3522a71dfaded1925136a40a7dc50eca4b3fe741078a73bdc
Contents?: true
Size: 947 Bytes
Versions: 7
Compression:
Stored size: 947 Bytes
Contents
require 'eucalypt/eucalypt-migration/namespaces/migration-create/generators/table' require 'eucalypt/app' require 'eucalypt/errors' require 'eucalypt/helpers' module Eucalypt class MigrationCreate < Thor include Eucalypt::Helpers using Colorize option :options, aliases: '-o', type: :hash, default: {}, enum: %w[primary_key id temporary force], desc: "Table options" desc "table [NAME] *[COLUMN∶TYPE]", "Creates a table".colorize(:grey) def table(name, *columns) directory = File.expand_path('.') if Eucalypt.app? directory validation = Eucalypt::Helpers::Migration::Validation.new columns return if validation.any_invalid? migration = Eucalypt::Generators::Create::Table.new migration.destination_root = directory migration.generate(name: name, columns: columns, options: options[:options]) else Eucalypt::Error.wrong_directory end end end end
Version data entries
7 entries across 7 versions & 1 rubygems