diff --git a/migrations/evm/20240924041138_index_performance.ts b/migrations/evm/20240924041138_index_performance.ts index c2149d231..ad52b0692 100644 --- a/migrations/evm/20240924041138_index_performance.ts +++ b/migrations/evm/20240924041138_index_performance.ts @@ -5,9 +5,18 @@ export async function up(knex: Knex): Promise { await knex.raw( 'CREATE INDEX IF NOT EXISTS erc721_token_erc721_contract_address_id_index ON erc721_token(erc721_contract_address, id)' ); + await knex.raw( + 'CREATE INDEX IF NOT EXISTS erc721_activity_contract_action_id_index on erc721_activity (erc721_contract_address, action, id)' + ); await knex.raw( 'CREATE INDEX IF NOT EXISTS erc721_holder_statistic_erc721_contract_address_count_index ON erc721_holder_statistic(erc721_contract_address, count)' ); } -export async function down(knex: Knex): Promise {} +export async function down(knex: Knex): Promise { + await knex.raw(`DROP INDEX erc721_token_erc721_contract_address_id_index`); + await knex.raw(`DROP INDEX erc721_activity_contract_action_id_index`); + await knex.raw( + `DROP INDEX erc721_holder_statistic_erc721_contract_address_count_index` + ); +} diff --git a/migrations/evm/20241003034314_create_from_to_account_id_in_evm_tx.ts b/migrations/evm/20241003034314_create_from_to_account_id_in_evm_tx.ts index d983c5e45..480956f82 100644 --- a/migrations/evm/20241003034314_create_from_to_account_id_in_evm_tx.ts +++ b/migrations/evm/20241003034314_create_from_to_account_id_in_evm_tx.ts @@ -5,6 +5,7 @@ export async function up(knex: Knex): Promise { await knex.schema.alterTable('evm_transaction', (table) => { table.integer('from_account_id').index(); table.integer('to_account_id').index(); + table.index(['to_account_id', 'id']); }); }