instance method
column
Ruby on Rails 6.0.6
Since v2.2.3Signature
column(column_name, type, **options)
Adds a new column to the named table.
t.column(:name, :string)
See TableDefinition#column for details of the options you can use.
Parameters
-
column_namereq -
typereq -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 546
def column(column_name, type, **options)
index_options = options.delete(:index)
@base.add_column(name, column_name, type, **options)
index(column_name, index_options.is_a?(Hash) ? index_options : {}) if index_options
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb line 546
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Table