Skip to content

Commit

Permalink
Document that index names are made up of all columns, not just the fi…
Browse files Browse the repository at this point in the history
…rst.

index_name has been using the following expression

    "index_#{table_name}_on_#{Array.wrap(options[:column]) * '_and_'}"

since at least 2006 (bc7f231), and that's how they come out in my DB.

Please check that this is correct before merging into master, perhaps
I'm misunderstanding the section I changed.
  • Loading branch information
joliss authored and vijaydev committed Dec 29, 2011
1 parent bea4f9a commit d8a43e2
Showing 1 changed file with 2 additions and 9 deletions.
Expand Up @@ -301,15 +301,8 @@ def rename_column(table_name, column_name, new_column_name)
# Adds a new index to the table. +column_name+ can be a single Symbol, or
# an Array of Symbols.
#
# The index will be named after the table and the first column name,
# unless you pass <tt>:name</tt> as an option.
#
# When creating an index on multiple columns, the first column is used as a name
# for the index. For example, when you specify an index on two columns
# [<tt>:first</tt>, <tt>:last</tt>], the DBMS creates an index for both columns as well as an
# index for the first column <tt>:first</tt>. Using just the first name for this index
# makes sense, because you will never have to create a singular index with this
# name.
# The index will be named after the table and the column name(s), unless
# you pass <tt>:name</tt> as an option.
#
# ===== Examples
#
Expand Down

0 comments on commit d8a43e2

Please sign in to comment.