diff options
author | Marcel Molina <marcel@vernix.org> | 2006-01-25 22:17:59 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-01-25 22:17:59 +0000 |
commit | 94046542e274f76ec9d31721a73a19e4b651fbfc (patch) | |
tree | 84677eeacf9cf70b20f75b8f63cd77e7327d2ac2 | |
parent | 463d208277cc245651d31b7601e2351b1d09563c (diff) | |
download | rails-94046542e274f76ec9d31721a73a19e4b651fbfc.tar.gz rails-94046542e274f76ec9d31721a73a19e4b651fbfc.tar.bz2 rails-94046542e274f76ec9d31721a73a19e4b651fbfc.zip |
Add documentation for add_index and remove_index. Closes #3600.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3487 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 166a37cb84..cd0737836f 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add documentation for add_index and remove_index. #3600 [Manfred Stienstra <m.stienstra@fngtps.com>] + * If the OCI library is not available, raise an exception indicating as much. #3593 [schoenm@earthlink.net] * Add explicit :order in finder tests as postgresql orders results differently by default. #3577. [Rick Olson] diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 09d0a80ff2..76967c0fe0 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -153,6 +153,13 @@ module ActiveRecord # The index will be named after the table and the first column names, # unless you pass +:name+ 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 + # [+:first+, +:last+], the DBMS creates an index for both columns as well as an + # index for the first colum +:first+. Using just the first name for this index + # makes sense, because you will never have to create a singular index with this + # name. + # # ===== Examples # ====== Creating a simple index # add_index(:suppliers, :name) @@ -187,7 +194,10 @@ module ActiveRecord # remove_index :accounts, :column => :branch_id # Remove the index named by_branch_party in the accounts table. # remove_index :accounts, :name => :by_branch_party - + # + # You can remove an index on multiple columns by specifying the first column. + # add_index :accounts, [:username, :password] + # remove_index :accounts, :username def remove_index(table_name, options = {}) execute "DROP INDEX #{index_name(table_name, options)} ON #{table_name}" end |