instance method
add_column
Ruby on Rails 4.2.9
Since v2.2.3Signature
add_column(table_name, column_name, type, options = {})
Adds a new column to the named table. See TableDefinition#column for details of the options you can use.
Parameters
-
table_namereq -
column_namereq -
typereq -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 404
def add_column(table_name, column_name, type, options = {})
at = create_alter_table table_name
at.add_column(column_name, type, options)
execute schema_creation.accept at
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb line 404
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::SchemaStatements