conflict_target and on_conflict for Block Rewards importer

Fixes #1297
pull/1302/head
Luke Imhoff 6 years ago
parent d25ffd2fcd
commit 1c915bdb3a
  1. 5
      apps/indexer/lib/indexer/block/uncataloged_rewards/importer.ex

@ -100,7 +100,10 @@ defmodule Indexer.Block.UncatalogedRewards.Importer do
defp insert_reward_group(rewards) do defp insert_reward_group(rewards) do
rewards rewards
|> Enum.reduce({Multi.new(), 0}, fn changeset, {multi, index} -> |> Enum.reduce({Multi.new(), 0}, fn changeset, {multi, index} ->
{Multi.insert(multi, "insert_#{index}", changeset), index + 1} {Multi.insert(multi, "insert_#{index}", changeset,
conflict_target: ~w(address_hash address_type block_hash),
on_conflict: {:replace, [:reward]}
), index + 1}
end) end)
|> elem(0) |> elem(0)
|> Explorer.Repo.transaction() |> Explorer.Repo.transaction()

Loading…
Cancel
Save