diff --git a/packages/neuron-wallet/src/database/chain/migrations/1572006450765-AddIndices.ts b/packages/neuron-wallet/src/database/chain/migrations/1572006450765-AddIndices.ts new file mode 100644 index 0000000000..7c6b4ba054 --- /dev/null +++ b/packages/neuron-wallet/src/database/chain/migrations/1572006450765-AddIndices.ts @@ -0,0 +1,17 @@ +import {MigrationInterface, QueryRunner, TableIndex} from "typeorm"; + +export class AddIndices1572006450765 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createIndex("input", new TableIndex({ columnNames: ["transactionHash", "lockHash"] })) + await queryRunner.createIndex("output", new TableIndex({ columnNames: ["transactionHash", "lockHash"] })) + await queryRunner.createIndex("transaction", new TableIndex({ columnNames: ["status"] })) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropIndex("input", new TableIndex({ columnNames: ["transactionHash", "lockHash"] })) + await queryRunner.dropIndex("output", new TableIndex({ columnNames: ["transactionHash", "lockHash"] })) + await queryRunner.dropIndex("transaction", new TableIndex({ columnNames: ["status"] })) + } + +} diff --git a/packages/neuron-wallet/src/database/chain/ormconfig.ts b/packages/neuron-wallet/src/database/chain/ormconfig.ts index 61f9c12f41..4b05b0d224 100644 --- a/packages/neuron-wallet/src/database/chain/ormconfig.ts +++ b/packages/neuron-wallet/src/database/chain/ormconfig.ts @@ -13,6 +13,7 @@ import { InitMigration1566959757554 } from './migrations/1566959757554-InitMigra import { AddTypeAndHasData1567144517514 } from './migrations/1567144517514-AddTypeAndHasData' import { ChangeHasDataDefault1568621556467 } from './migrations/1568621556467-ChangeHasDataDefault' import { AddLockToInput1570522869590 } from './migrations/1570522869590-AddLockToInput' +import { AddIndices1572006450765 } from './migrations/1572006450765-AddIndices' export const CONNECTION_NOT_FOUND_NAME = 'ConnectionNotFoundError' @@ -38,6 +39,7 @@ const connectOptions = async (genesisBlockHash: string): Promise