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

Signed-off-by: Emilio Tagua <miloops@gmail.com>
This commit is contained in:
Ernie Miller 2010-03-31 15:52:20 -04:00 committed by Emilio Tagua
parent b3980af8d1
commit ccf8311123
2 changed files with 8 additions and 1 deletions

@ -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

@ -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