Add order by token.type

pull/3902/head
Viktor Baranov 4 years ago
parent 3ec4b4d99c
commit a01f4ab2c5
  1. 2
      apps/explorer/lib/explorer/chain/import/runner/blocks.ex
  2. 5
      apps/explorer/lib/explorer/chain/import/runner/tokens.ex

@ -344,6 +344,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do
select: map(tb, [:address_hash, :token_contract_address_hash, :block_number]),
# Enforce TokenBalance ShareLocks order (see docs: sharelocks.md)
order_by: [
tb.token_type,
tb.token_contract_address_hash,
tb.address_hash,
tb.block_number
@ -381,6 +382,7 @@ defmodule Explorer.Chain.Import.Runner.Blocks do
select: map(ctb, [:address_hash, :token_contract_address_hash]),
# Enforce CurrentTokenBalance ShareLocks order (see docs: sharelocks.md)
order_by: [
ctb.token_type,
ctb.token_contract_address_hash,
ctb.address_hash
],

@ -27,7 +27,10 @@ defmodule Explorer.Chain.Import.Runner.Tokens do
token in Token,
where: token.contract_address_hash in ^contract_address_hashes,
# Enforce Token ShareLocks order (see docs: sharelocks.md)
order_by: token.contract_address_hash,
order_by: [
token.type,
token.contract_address_hash
],
lock: "FOR UPDATE"
)

Loading…
Cancel
Save