Skip to content

Commit

Permalink
Fix test of index names (now limited to 62 bytes by rails)
Browse files Browse the repository at this point in the history
See rails/rails@3682aa1

So the shortening of index names that was added to rails itself
was almost immediately changed to use an 'idx_' prefix instead of an 'ix_'
prefix.

See rails/rails@59f2b06

However, now that rails does shortening. It is an opportunity to
simplify this library and just rely on the rails index name shortening.
  • Loading branch information
andynu committed Mar 25, 2024
1 parent 5937550 commit 131e39b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ class ::TestEmployee < ActiveRecord::Base; end
it "should raise error if too large index name cannot be shortened" do
if @oracle12cr2_or_higher
expect(@conn.index_name("test_employees", column: ["first_name", "middle_name", "last_name"])).to eq(
("index_test_employees_on_first_name_and_middle_name_and_last_name"))
("idx_on_first_name_middle_name_last_name_ee1d3958bc"))
else
expect(@conn.index_name("test_employees", column: ["first_name", "middle_name", "last_name"])).to eq(
"i" + OpenSSL::Digest::SHA1.hexdigest("index_test_employees_on_first_name_and_middle_name_and_last_name")[0, 29]
"i" + OpenSSL::Digest::SHA1.hexdigest("idx_on_first_name_middle_name_last_name_ee1d3958bc")[0, 29]
)
end
end
Expand Down

0 comments on commit 131e39b

Please sign in to comment.