From cb4bfc2cad70f8798d32337f6f73dd763dded98c Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 1 Mar 2019 13:14:06 +0300 Subject: [PATCH 1/2] remove duplicated indexes --- ...20190301095620_remove_duplicated_indexes.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs diff --git a/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs b/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs new file mode 100644 index 0000000000..6ba781f0f0 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs @@ -0,0 +1,17 @@ +defmodule Explorer.Repo.Migrations.RemoveDuplicatedIndexes do + use Ecto.Migration + + def change do + drop_if_exists index(:address_current_token_balances, [:address_hash, :block_number, :token_contract_address_hash], name: "address_current_token_balances_block_number_index") + drop_if_exists index(:internal_transactions, [:to_address_hash], name: "internal_transactions_to_address_hash_index") + drop_if_exists index(:internal_transactions, [:transaction_hash], name: "internal_transactions_transaction_hash_index") + drop_if_exists index(:logs, [:transaction_hash], name: "logs_transaction_hash_index") + drop_if_exists index(:token_transfers, [:from_address_hash], name: "token_transfers_from_address_hash_index") + drop_if_exists index(:token_transfers, [:to_address_hash], name: "token_transfers_to_address_hash_index") + drop_if_exists index(:token_transfers, [:transaction_hash], name: "token_transfers_transaction_hash_index") + drop_if_exists index(:transaction_forks, [:uncle_hash], name: "transaction_forks_uncle_hash_index") + drop_if_exists index(:transactions, [:block_hash], name: "transactions_block_hash_index") + drop_if_exists index(:transactions, [:created_contract_address_hash], name: "transactions_created_contract_address_hash_index") + drop_if_exists index(:user_contracts, [:user_id], name: "user_contacts_user_id_index") + end +end From 81587c4c518ebccc14219bcddf71ba5517803c89 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 1 Mar 2019 13:17:49 +0300 Subject: [PATCH 2/2] mix format --- ...190301095620_remove_duplicated_indexes.exs | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs b/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs index 6ba781f0f0..f89d9a3652 100644 --- a/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs +++ b/apps/explorer/priv/repo/migrations/20190301095620_remove_duplicated_indexes.exs @@ -2,16 +2,31 @@ defmodule Explorer.Repo.Migrations.RemoveDuplicatedIndexes do use Ecto.Migration def change do - drop_if_exists index(:address_current_token_balances, [:address_hash, :block_number, :token_contract_address_hash], name: "address_current_token_balances_block_number_index") - drop_if_exists index(:internal_transactions, [:to_address_hash], name: "internal_transactions_to_address_hash_index") - drop_if_exists index(:internal_transactions, [:transaction_hash], name: "internal_transactions_transaction_hash_index") - drop_if_exists index(:logs, [:transaction_hash], name: "logs_transaction_hash_index") - drop_if_exists index(:token_transfers, [:from_address_hash], name: "token_transfers_from_address_hash_index") - drop_if_exists index(:token_transfers, [:to_address_hash], name: "token_transfers_to_address_hash_index") - drop_if_exists index(:token_transfers, [:transaction_hash], name: "token_transfers_transaction_hash_index") - drop_if_exists index(:transaction_forks, [:uncle_hash], name: "transaction_forks_uncle_hash_index") - drop_if_exists index(:transactions, [:block_hash], name: "transactions_block_hash_index") - drop_if_exists index(:transactions, [:created_contract_address_hash], name: "transactions_created_contract_address_hash_index") - drop_if_exists index(:user_contracts, [:user_id], name: "user_contacts_user_id_index") + drop_if_exists( + index(:address_current_token_balances, [:address_hash, :block_number, :token_contract_address_hash], + name: "address_current_token_balances_block_number_index" + ) + ) + + drop_if_exists( + index(:internal_transactions, [:to_address_hash], name: "internal_transactions_to_address_hash_index") + ) + + drop_if_exists( + index(:internal_transactions, [:transaction_hash], name: "internal_transactions_transaction_hash_index") + ) + + drop_if_exists(index(:logs, [:transaction_hash], name: "logs_transaction_hash_index")) + drop_if_exists(index(:token_transfers, [:from_address_hash], name: "token_transfers_from_address_hash_index")) + drop_if_exists(index(:token_transfers, [:to_address_hash], name: "token_transfers_to_address_hash_index")) + drop_if_exists(index(:token_transfers, [:transaction_hash], name: "token_transfers_transaction_hash_index")) + drop_if_exists(index(:transaction_forks, [:uncle_hash], name: "transaction_forks_uncle_hash_index")) + drop_if_exists(index(:transactions, [:block_hash], name: "transactions_block_hash_index")) + + drop_if_exists( + index(:transactions, [:created_contract_address_hash], name: "transactions_created_contract_address_hash_index") + ) + + drop_if_exists(index(:user_contracts, [:user_id], name: "user_contacts_user_id_index")) end end