aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts')
-rw-r--r--packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts31
1 files changed, 0 insertions, 31 deletions
diff --git a/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts b/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts
deleted file mode 100644
index 874713e67..000000000
--- a/packages/pipeline/migrations/1549499426238-AddTxHashToERC20ApprovalEventPrimaryKey.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { MigrationInterface, QueryRunner } from 'typeorm';
-
-const oldPrimaryColumns = ['token_address', 'log_index', 'block_number'];
-
-const newPrimaryColumns = ['transaction_hash'];
-
-async function updatePrimaryKeysAsync(queryRunner: QueryRunner, columnNames: string[]): Promise<void> {
- const table = await queryRunner.getTable(`raw.erc20_approval_events`);
- if (table === undefined) {
- throw new Error(`Couldn't get table 'raw.erc20_approval_events'`);
- }
- const columns = [];
- for (const columnName of columnNames) {
- const column = table.findColumnByName(columnName);
- if (column === undefined) {
- throw new Error(`Couldn't get column '${columnName}' from table 'raw.erc20_approval_events'`);
- }
- columns.push(column);
- }
- await queryRunner.updatePrimaryKeys(table, columns);
-}
-
-export class AddTxHashToERC20ApprovalEventPrimaryKey1549499426238 implements MigrationInterface {
- public async up(queryRunner: QueryRunner): Promise<any> {
- await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns.concat(newPrimaryColumns));
- }
-
- public async down(queryRunner: QueryRunner): Promise<any> {
- await updatePrimaryKeysAsync(queryRunner, oldPrimaryColumns);
- }
-}