add_column(table_name, column_name, type, options = {}) Ver: 2.0.1
From: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter Version 2.0.1
Comments

Adds a column to a table.

Sourcecode
# File /Users/nshb/svn/svn.inimit.com/railsmanual.com/www/trunk/src/rails-2.0.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 594
      def add_column(table_name, column_name, type, options = {})
        default = options[:default]
        notnull = options[:null] == false

        # Add the column.
        execute("ALTER TABLE #{table_name} ADD COLUMN #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit])}")

        change_column_default(table_name, column_name, default) if options_include_default?(options)
        change_column_null(table_name, column_name, false, default) if notnull
      end
Add New Note User Added Notes