Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix mapping of bigint/smallint/uuid columns in postgresql adapter.

Signed-off-by: Emilio Tagua <miloops@gmail.com>
  • Loading branch information...
commit ccf8311123a448fb82a568a57974d58b6b990837 1 parent b3980af
@ernie ernie authored miloops committed
View
3  activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -23,7 +23,8 @@ module Format
#
# +name+ is the column's name, such as <tt>supplier_id</tt> in <tt>supplier_id int(11)</tt>.
# +default+ is the type-casted default value, such as +new+ in <tt>sales_stage varchar(20) default 'new'</tt>.
- # +sql_type+ is only used to extract the column's length, if necessary. For example +60+ in <tt>company_name varchar(60)</tt>.
+ # +sql_type+ is used to extract the column's length, if necessary. For example +60+ in <tt>company_name varchar(60)</tt>.
+ # It will be mapped to one of the standard Rails SQL types in the <tt>type</tt> attribute.
# +null+ determines if this column allows +NULL+ values.
def initialize(name, default, sql_type = nil, null = true)
@name, @sql_type, @null = name, sql_type, null
View
6 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -114,6 +114,12 @@ def simplified_type(field_type)
# Object identifier types
when /^oid$/
:integer
+ # UUID type
+ when /^uuid$/
+ :string
+ # Small and big integer types
+ when /^(?:small|big)int$/
+ :integer
# Pass through all types that are not specific to PostgreSQL.
else
super
Please sign in to comment.
Something went wrong with that request. Please try again.