Class: ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::TableDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract_mysql_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ TableDefinition

Returns a new instance of TableDefinition.



8
9
10
# File 'lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract_mysql_adapter.rb', line 8

def initialize(base)
  @base = base
end

Instance Method Details

#new_column_definition(name, type, options) ⇒ Object

:nodoc:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract_mysql_adapter.rb', line 12

def new_column_definition(name, type, options) # :nodoc:
  column = create_column_definition name, type
  limit = options.fetch(:limit) do
    native[type][:limit] if native[type].is_a?(Hash)
  end

  column.limit       = limit
  column.precision   = options[:precision]
  column.scale       = options[:scale]
  column.unsigned    = options[:unsigned]
  column.default     = options[:default]
  column.null        = options[:null]
  column.first       = options[:first]
  column.after       = options[:after]
  column
end