From ce72493adc9ca31cd93bac1a5d15a4d733f8828e Mon Sep 17 00:00:00 2001 From: Ernie Miller Date: Wed, 31 Mar 2010 15:52:20 -0400 Subject: [PATCH] Fix mapping of bigint/smallint/uuid columns in postgresql adapter. --- .../abstract/schema_definitions.rb | 3 ++- .../connection_adapters/postgresql_adapter.rb | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 046825d..6c477e4 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -23,7 +23,8 @@ module ActiveRecord # # +name+ is the column's name, such as supplier_id in supplier_id int(11). # +default+ is the type-casted default value, such as +new+ in sales_stage varchar(20) default 'new'. - # +sql_type+ is only used to extract the column's length, if necessary. For example +60+ in company_name varchar(60). + # +sql_type+ is used to extract the column's length, if necessary. For example +60+ in company_name varchar(60). + # It will be mapped to one of the standard Rails SQL types in the type 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 diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index a6042e1..2395a74 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -114,6 +114,12 @@ module ActiveRecord # 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 -- 1.6.4.4