From 0f7aba63370adf98ce7121ac31f32818dc591c1a Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 7 Aug 2024 11:48:38 +0300 Subject: [PATCH] fix: Fetch contract methods decoding candidates sorted by inserted_at (#10529) * Fetch contract methods decoding candidates sorted by inserted_at * Add contract_methods inserted_at B-tree index --- apps/explorer/lib/explorer/chain/contract_method.ex | 1 + ...240806162644_add_contract_methods_inserted_at_index.exs | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs diff --git a/apps/explorer/lib/explorer/chain/contract_method.ex b/apps/explorer/lib/explorer/chain/contract_method.ex index c4716cde00..8d1c381571 100644 --- a/apps/explorer/lib/explorer/chain/contract_method.ex +++ b/apps/explorer/lib/explorer/chain/contract_method.ex @@ -72,6 +72,7 @@ defmodule Explorer.Chain.ContractMethod do from( contract_method in __MODULE__, where: contract_method.identifier == ^method_id, + order_by: [asc: contract_method.inserted_at], limit: ^limit ) end diff --git a/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs b/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs new file mode 100644 index 0000000000..b025f59ebe --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20240806162644_add_contract_methods_inserted_at_index.exs @@ -0,0 +1,7 @@ +defmodule Explorer.Repo.Migrations.AddContractMethodsInsertedAtIndex do + use Ecto.Migration + + def change do + create(index(:contract_methods, [:inserted_at])) + end +end