method
add_column
v1.1.6 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
add_column(table_name, column_name, type, options = {})public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 314
def add_column(table_name, column_name, type, options = {})
execute("ALTER TABLE #{table_name} ADD #{column_name} #{type_to_sql(type, options[:limit])}")
execute("ALTER TABLE #{table_name} ALTER #{column_name} SET NOT NULL") if options[:null] == false
change_column_default(table_name, column_name, options[:default]) unless options[:default].nil?
end