aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
blob: 267cf144befb9968af09c20680ffdd58b868a49c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { MigrationInterface, QueryRunner, Table } from 'typeorm';

const dexTrades = new Table({
    name: 'raw.dex_trades',
    columns: [
        { name: 'source_url', type: 'varchar', isPrimary: true },
        { name: 'tx_hash', type: 'varchar', isPrimary: true },

        { name: 'tx_timestamp', type: 'bigint' },
        { name: 'tx_date', type: 'varchar' },
        { name: 'tx_sender', type: 'varchar(42)' },
        { name: 'smart_contract_id', type: 'bigint' },
        { name: 'smart_contract_address', type: 'varchar(42)' },
        { name: 'contract_type', type: 'varchar' },
        { name: 'maker', type: 'varchar(42)' },
        { name: 'taker', type: 'varchar(42)' },
        { name: 'amount_buy', type: 'numeric' },
        { name: 'maker_fee_amount', type: 'numeric' },
        { name: 'buy_currency_id', type: 'bigint' },
        { name: 'buy_symbol', type: 'varchar' },
        { name: 'amount_sell', type: 'numeric' },
        { name: 'taker_fee_amount', type: 'numeric' },
        { name: 'sell_currency_id', type: 'bigint' },
        { name: 'sell_symbol', type: 'varchar' },
        { name: 'maker_annotation', type: 'varchar' },
        { name: 'taker_annotation', type: 'varchar' },
        { name: 'protocol', type: 'varchar' },
        { name: 'buy_address', type: 'varchar(42)', isNullable: true },
        { name: 'sell_address', type: 'varchar(42)', isNullable: true },
    ],
});

export class CreateDexTrades1543446690436 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.createTable(dexTrades);
    }

    public async down(queryRunner: QueryRunner): Promise<any> {
        await queryRunner.dropTable(dexTrades);
    }
}