Method: ActiveRecord::ConnectionAdapters::SchemaStatements#add_column

Defined in:
lib/active_record/connection_adapters/abstract/schema_statements.rb

#add_column(table_name, column_name, type, options = {}) ⇒ Object

Adds a new column to the named table. See TableDefinition#column for details of the options you can use.



357
358
359
360
361
# File 'lib/active_record/connection_adapters/abstract/schema_statements.rb', line 357

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