未验证 提交 611f2b29 编写于 作者: M Mehmet Emin İNAÇ 提交者: Mehmet Emin INAC

Use algorithm while removing index with db:rollback

Closes #24190
上级 6c199967
* Use given algorithm while removing index from database.
Fixes #24190.
*Mehmet Emin İNAÇ*
* Update payload names for `sql.active_record` instrumentation to be
more descriptive.
......
......@@ -161,8 +161,8 @@ def invert_add_index(args)
table, columns, options = *args
options ||= {}
index_name = options[:name]
options_hash = index_name ? { name: index_name } : { column: columns }
options_hash = options.slice(:name, :algorithm)
options_hash[:column] = columns if !options_hash[:name]
[:remove_index, [table, options_hash]]
end
......
......@@ -213,6 +213,11 @@ def test_invert_add_index_with_name
assert_equal [:remove_index, [:table, { name: "new_index" }]], remove
end
def test_invert_add_index_with_algorithm_option
remove = @recorder.inverse_of :add_index, [:table, :one, algorithm: :concurrently]
assert_equal [:remove_index, [:table, { column: :one, algorithm: :concurrently }]], remove
end
def test_invert_remove_index
add = @recorder.inverse_of :remove_index, [:table, :one]
assert_equal [:add_index, [:table, :one]], add
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册