提交 7cc36862 编写于 作者: G Guilherme Mansur

Document algorithm: concurrent options for PostgreSQL [ci skip]

上级 c2fcc6ac
......@@ -770,6 +770,17 @@ def rename_column(table_name, column_name, new_column_name)
# 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 @@ def add_index(table_name, column_name, options = {})
#
# 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)}"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册