I am able to create new tables with native types in migrations like this (note the use of :smallint):
create_table :foo, :force => true do |t|
t.column :bar, :smallint
end
But I can't add a column with a native type:
add_column :foo, :smallint
The attached patch fixes this issue. Without the whitespace changes, it's simply:
def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
- native = native_database_types[type]
+ if native = native_database_types[type]
column_type_sql = native.is_a?(Hash) ? native[:name] : native
if type == :decimal # ignore limit, use precison and scale
precision ||= native[:precision]
@@ -273,6 +273,9 @@
column_type_sql << "(#{limit})" if limit
column_type_sql
end
+ else
+ column_type_sql = type
+ end
end
def add_column_options!(sql, options) #:nodoc:
Thanks!