Permalink
Browse files

Fixes definition of citext in PostgreSQLAdapter

Fixes issue #62
  • Loading branch information...
1 parent 0e955eb commit 5928398fb95f163fd1b72776b6d6ac71c0242f6c @danmcclain danmcclain committed Feb 13, 2013
@@ -127,7 +127,8 @@ def simplified_type_with_extended_types(field_type)
class PostgreSQLAdapter
class UnsupportedFeature < Exception; end
- EXTENDED_TYPES = {:inet => {:name => 'inet'}, :cidr => {:name => 'cidr'}, :macaddr => {:name => 'macaddr'}, :uuid => {:name => 'uuid'}, :citext => {:citext => 'citext'}}
+ EXTENDED_TYPES = { :inet => {:name => 'inet'}, :cidr => {:name => 'cidr'}, :macaddr => {:name => 'macaddr'},
+ :uuid => {:name => 'uuid'}, :citext => {:name => 'citext'} }
class ColumnDefinition < ActiveRecord::ConnectionAdapters::ColumnDefinition
attr_accessor :array
@@ -10,18 +10,23 @@
t.citext :citext_1
t.citext :citext_2, :citext_3
t.column :citext_4, :citext
+ t.text :citext_5
end
+
+ connection.change_column :data_types, :citext_5, :citext
end.should_not raise_exception
columns = connection.columns(:data_types)
citext_1 = columns.detect { |c| c.name == 'citext_1'}
citext_2 = columns.detect { |c| c.name == 'citext_2'}
citext_3 = columns.detect { |c| c.name == 'citext_3'}
citext_4 = columns.detect { |c| c.name == 'citext_4'}
+ citext_5 = columns.detect { |c| c.name == 'citext_5'}
citext_1.sql_type.should eq 'citext'
citext_2.sql_type.should eq 'citext'
citext_3.sql_type.should eq 'citext'
citext_4.sql_type.should eq 'citext'
+ citext_5.sql_type.should eq 'citext'
end
end

0 comments on commit 5928398

Please sign in to comment.