Update token type in balances tables

pull/4761/head
Viktor Baranov 3 years ago
parent 3758375e82
commit 71ca021d7a
  1. 16
      apps/explorer/priv/repo/migrations/20211013190346_remove_duplicates_of_current_token_balances.exs

@ -35,5 +35,21 @@ defmodule Explorer.Repo.Migrations.RemoveDuplicatesOfCurrentTokenBalances do
) a
);
""")
execute("""
UPDATE address_current_token_balances
SET token_type = t.type
FROM tokens t
WHERE address_current_token_balances.token_type IS NULL
AND t.contract_address_hash = address_current_token_balances.token_contract_address_hash;
""")
execute("""
UPDATE address_token_balances
SET token_type = t.type
FROM tokens t
WHERE address_token_balances.token_type IS NULL
AND t.contract_address_hash = address_token_balances.token_contract_address_hash;
""")
end
end

Loading…
Cancel
Save