Class: ActiveRecord::ConnectionAdapters::MySQL::TableDefinition

Inherits:
TableDefinition
  • Object
show all
Includes:
ColumnMethods
Defined in:
lib/active_record/connection_adapters/mysql/schema_definitions.rb

Instance Attribute Summary

Attributes inherited from TableDefinition

#as, #comment, #foreign_keys, #indexes, #name, #options, #temporary

Instance Method Summary collapse

Methods included from ColumnMethods

#blob, #longblob, #longtext, #mediumblob, #mediumtext, #tinyblob, #tinytext, #unsigned_bigint, #unsigned_decimal, #unsigned_float, #unsigned_integer

Methods inherited from TableDefinition

#[], #column, #columns, #foreign_key, #index, #initialize, #primary_keys, #references, #remove_column, #timestamps

Methods included from ColumnMethods

#primary_key

Constructor Details

This class inherits a constructor from ActiveRecord::ConnectionAdapters::TableDefinition

Instance Method Details

#new_column_definition(name, type, **options) ⇒ Object

:nodoc:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 55

def new_column_definition(name, type, **options) # :nodoc:
  case type
  when :virtual
    type = options[:type]
  when :primary_key
    type = :integer
    options[:limit] ||= 8
    options[:primary_key] = true
  when /\Aunsigned_(?<type>.+)\z/
    type = $~[:type].to_sym
    options[:unsigned] = true
  end

  super
end