Skip to content

Commit 59f2b06

Browse files
committed
Use idx_ instead of ix_ for index prefix
Followup: rails#47753
1 parent 37c5181 commit 59f2b06

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

activerecord/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
After (short format):
1414
```
15-
ix_on_foo_bar_first_name_last_name_administrator_5939248142
15+
idx_on_foo_bar_first_name_last_name_administrator_5939248142
1616
```
1717
1818
The short format includes a hash to ensure the name is unique database-wide.

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ def generate_index_name(table_name, column)
15211521

15221522
# Fallback to short version, add hash to ensure uniqueness
15231523
hashed_identifier = "_" + OpenSSL::Digest::SHA256.hexdigest(name).first(10)
1524-
name = "ix_on_#{Array(column) * '_'}"
1524+
name = "idx_on_#{Array(column) * '_'}"
15251525

15261526
short_limit = max_index_name_size - hashed_identifier.bytesize
15271527
short_name = name.mb_chars.limit(short_limit).to_s

activerecord/test/cases/migration/index_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_add_index_with_if_not_exists_matches_exact_index
105105

106106
def test_add_index_fallback_to_short_name
107107
connection.add_index(table_name, [:foo, :bar, :first_name, :last_name, :administrator])
108-
assert connection.index_name_exists?(table_name, "ix_on_foo_bar_first_name_last_name_administrator_5939248142")
108+
assert connection.index_name_exists?(table_name, "idx_on_foo_bar_first_name_last_name_administrator_5939248142")
109109
end
110110

111111
def test_remove_index_which_does_not_exist_doesnt_raise_with_option

0 commit comments

Comments
 (0)