Commit 863120aa authored by Krasimir Angelov's avatar Krasimir Angelov

Use find_or_create_by to avoid subtransactions

Use `find_or_create_by` instead of `safe_find_or_create_by` to avoid
subtransactions.
parent bdab6b9c
......@@ -67,7 +67,7 @@ class PrepareAsyncIndexesForCiBuilds < Gitlab::Database::Migration[1.0]
return if index_name_exists?(table_name, index_name)
async_index = Gitlab::Database::AsyncIndexes::PostgresAsyncIndex.safe_find_or_create_by!(name: index_name) do |rec|
async_index = Gitlab::Database::AsyncIndexes::PostgresAsyncIndex.find_or_create_by!(name: index_name) do |rec|
rec.table_name = table_name
rec.definition = definition
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment