diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-04-19 10:28:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 10:28:32 -0400 |
commit | 5e77be32a86320a20478073b2a34b5ea7aef2aed (patch) | |
tree | 06fa990e3e88a8315bd181adf8a08b45cdb1f3c4 /activerecord/lib/active_record | |
parent | 75aeb3617153efbc2c6fd28d03f364f7c38a446a (diff) | |
parent | 7cc368621524a567781f3a64db135e6bead1c1bb (diff) | |
download | rails-5e77be32a86320a20478073b2a34b5ea7aef2aed.tar.gz rails-5e77be32a86320a20478073b2a34b5ea7aef2aed.tar.bz2 rails-5e77be32a86320a20478073b2a34b5ea7aef2aed.zip |
Merge pull request #35998 from itsWill/add_documentation_for_add_index
Document algorithm: concurrent option for PostgreSQL [ci skip]
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 20 |
1 files changed, 20 insertions, 0 deletions
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 7041d92586..2b64e96450 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -770,6 +770,17 @@ module ActiveRecord # CREATE FULLTEXT INDEX index_developers_on_name ON developers (name) -- MySQL # # Note: only supported by MySQL. + # + # ====== Creating an index with a specific algorithm + # + # add_index(:developers, :name, algorithm: :concurrently) + # # CREATE INDEX CONCURRENTLY developers_on_name on developers (name) + # + # Note: only supported by PostgreSQL. + # + # Concurrently adding an index is not supported in a transaction. + # + # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. def add_index(table_name, column_name, options = {}) index_name, index_type, index_columns, index_options = add_index_options(table_name, column_name, options) execute "CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{index_columns})#{index_options}" @@ -793,6 +804,15 @@ module ActiveRecord # # remove_index :accounts, name: :by_branch_party # + # Removes the index named +by_branch_party+ in the +accounts+ table +concurrently+. + # + # remove_index :accounts, name: :by_branch_party, algorithm: :concurrently + # + # Note: only supported by PostgreSQL. + # + # Concurrently removing an index is not supported in a transaction. + # + # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration]. def remove_index(table_name, options = {}) index_name = index_name_for_remove(table_name, options) execute "DROP INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)}" |