Skip to content

Commit

Permalink
fix: update index in old migration
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Oct 7, 2024
1 parent 934015c commit 2f7cbf2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion migrations/evm/20240924041138_index_performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ export async function up(knex: Knex): Promise<void> {
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<void> {}
export async function down(knex: Knex): Promise<void> {
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`
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export async function up(knex: Knex): Promise<void> {
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']);
});
}

Expand Down

0 comments on commit 2f7cbf2

Please sign in to comment.