aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pipeline/migrations/1543446690436-CreateDexTrades.ts')
-rw-r--r--packages/pipeline/migrations/1543446690436-CreateDexTrades.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts b/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
new file mode 100644
index 000000000..267cf144b
--- /dev/null
+++ b/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
@@ -0,0 +1,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);
+ }
+}