Added saving to database

This commit is contained in:
askeluv
2019-02-12 12:30:10 +08:00
parent 7ad4cb0078
commit c0a2f429b6
8 changed files with 98 additions and 52 deletions

View File

@@ -0,0 +1,28 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";
const slippage = new Table({
name: 'raw.slippage',
columns: [
{ name: 'observed_timestamp', type: 'bigint', isPrimary: true },
{ name: 'symbol', type: 'varchar', isPrimary: true },
{ name: 'exchange', type: 'varchar', isPrimary: true },
{ name: 'usd_amount', type: 'numeric', isPrimary: true },
{ name: 'token_amount', type: 'numeric', isNullable: false },
{ name: 'avg_price_in_eth_buy', type: 'numeric', isNullable: true },
{ name: 'avg_price_in_eth_sell', type: 'numeric', isNullable: true },
{ name: 'slippage', type: 'numeric', isNullable: true },
],
});
export class CreateSlippageTable1549856835629 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.createTable(slippage);
}
public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.dropTable(slippage);
}
}