Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 3 contributors
View
2 lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb
@@ -117,7 +117,7 @@ def structure_dump_indexes(table_name) #:nodoc:
else
index_type = options
end
- quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(", ")
+ quoted_column_names = column_names.map { |e| quote_column_name_or_expression(e) }.join(", ")
"CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})"
end
end
View
12 spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
@@ -181,6 +181,18 @@ class ::TestPost < ActiveRecord::Base
dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FOO\"? ON "?TEST_POSTS"? \("?FOO"?\)/i
dump.should_not =~ /CREATE UNIQUE INDEX "?UK_TEST_POSTS_/i
end
+
+ it "should dump multi-value and function value indexes" do
+ ActiveRecord::Base.connection.add_index(:test_posts, [:foo, :foo_id], :name => :ix_test_posts_foo_foo_id)
+
+ @conn.execute <<-SQL
+ CREATE INDEX "IX_TEST_POSTS_FUNCTION" ON "TEST_POSTS" (TO_CHAR(LENGTH("FOO"))||"FOO")
+ SQL
+
+ dump = ActiveRecord::Base.connection.structure_dump
+ dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FOO_FOO_ID\"? ON "?TEST_POSTS"? \("?FOO"?, "?FOO_ID"?\)/i
+ dump.should =~ /CREATE INDEX "?IX_TEST_POSTS_FUNCTION\"? ON "?TEST_POSTS"? \(TO_CHAR\(LENGTH\("?FOO"?\)\)\|\|"?FOO"?\)/i
+ end
end
describe "temporary tables" do
after(:all) do

No commit comments for this range

Something went wrong with that request. Please try again.