class ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation - activerecord-4.2.5.2 Documentation

# class ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation

### Private Instance Methods

add_column_options!(sql, options) click to toggle source
Calls superclass method

    # File lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 16
    def add_column_options!(sql, options)
      if options[:array] || options[:column].try(:array)
        sql << '[]'
      end

      column = options.fetch(:column) { return super }
      if column.type == :uuid && options[:default] =~ /\(\)/
        sql << " DEFAULT #{options[:default]}"
      else
        super
      end
    end

type_for_column(column) click to toggle source
Calls superclass method

    # File lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 29
    def type_for_column(column)
      if column.array
        @conn.lookup_cast_type("#{column.sql_type}[]")
      else
        super
      end
    end

visit_ColumnDefinition(o) click to toggle source
Calls superclass method

    # File lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 7
    def visit_ColumnDefinition(o)
      sql = super
      if o.primary_key? && o.type != :primary_key
        sql << " PRIMARY KEY "
        add_column_options!(sql, column_options(o))
      end
      sql
    end