method
new_column_definition
v4.2.7 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::TableDefinition
new_column_definition(name, type, options)public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 335
def new_column_definition(name, type, options) # :nodoc:
type = aliased_types(type.to_s, type)
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.default = options[:default]
column.null = options[:null]
column.first = options[:first]
column.after = options[:after]
column.primary_key = type == :primary_key || options[:primary_key]
column
end