Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Merge 2c2f28f into 59ea144
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeauclair committed Feb 4, 2015
2 parents 59ea144 + 2c2f28f commit 91dc1d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def indexes(table_name, name = nil) #:nodoc:
opclass_name[oid.to_s] = opcname
end
operator_classes = {}
index_keys.zip(opclasses).each do |index_key, opclass|
operator_classes[columns[index_key]] = opclass_name[opclass]
column_names.zip(opclasses).each do |column_name, opclass|
operator_classes[column_name] = opclass_name[opclass]
end
operator_classes.delete_if{|k,v| v.nil?}

Expand Down
6 changes: 6 additions & 0 deletions spec/schema_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ class ::Comment < ActiveRecord::Base ; end
end
end

it 'should dump proper operator_class with case_sensitive => false' do
with_index Post, :body, :operator_class => 'text_pattern_ops', :case_sensitive => false do
expect(dump_posts).to match(to_regexp(%q{t.index ["body"], :name => "index_posts_on_body", :case_sensitive => false, :operator_class => {"body" => "text_pattern_ops"}}))
end
end

it "should dump unique: true with expression (Issue #142)" do
with_index Post, :name => "posts_user_body_index", :unique => true, :expression => "BTRIM(LOWER(body))" do
expect(dump_posts).to match(%r{#{to_regexp(%q{t.index :name => "posts_user_body_index", :unique => true, :expression => "btrim(lower(body))"})}$})
Expand Down

0 comments on commit 91dc1d5

Please sign in to comment.