Skip to content

Commit 169f87e

Browse files
authored
Merge pull request rsim#2729 from yahonda/refactor-structure-dump-indexes
Refactor structure_dump_indexes: drop dead Hash/String branch + variable shadowing
2 parents 400391e + 42a7735 commit 169f87e

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,9 @@ def structure_dump_unique_keys(table) # :nodoc:
161161
end
162162

163163
def structure_dump_indexes(table_name) # :nodoc:
164-
indexes(table_name).map do |options|
165-
column_names = options.columns
166-
options = { name: options.name, unique: options.unique }
167-
index_name = index_name(table_name, column: column_names)
168-
if Hash === options # legacy support, since this param was a string
169-
unique = options[:unique]
170-
index_name = options[:name] || index_name
171-
else
172-
# Legacy String form only ever carried "UNIQUE" / ""; BITMAP and
173-
# other index_types were never supported via this helper.
174-
unique = (options == "UNIQUE")
175-
end
176-
quoted_column_names = column_names.map { |e| quote_column_name_or_expression(e) }.join(", ")
177-
"CREATE#{' UNIQUE' if unique} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})"
164+
indexes(table_name).map do |index|
165+
quoted_column_names = index.columns.map { |c| quote_column_name_or_expression(c) }.join(", ")
166+
"CREATE#{' UNIQUE' if index.unique} INDEX #{quote_column_name(index.name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})"
178167
end
179168
end
180169

0 commit comments

Comments
 (0)