From 71ca021d7aa44f844d1236e6a8286cdeec0ad9cf Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Fri, 15 Oct 2021 13:15:25 +0300 Subject: [PATCH] Update token type in balances tables --- ...move_duplicates_of_current_token_balances.exs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/explorer/priv/repo/migrations/20211013190346_remove_duplicates_of_current_token_balances.exs b/apps/explorer/priv/repo/migrations/20211013190346_remove_duplicates_of_current_token_balances.exs index 3f0c9a4165..ec26db4b73 100644 --- a/apps/explorer/priv/repo/migrations/20211013190346_remove_duplicates_of_current_token_balances.exs +++ b/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