Skip to content

Commit

Permalink
Fixes definition of citext in PostgreSQLAdapter
Browse files Browse the repository at this point in the history
Fixes issue #62
  • Loading branch information
danmcclain committed Feb 13, 2013
1 parent 0e955eb commit 5928398
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/migrations/citext_spec.rb
Expand Up @@ -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.