aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations
diff options
context:
space:
mode:
authorzkao <zichongkao@gmail.com>2018-12-12 07:48:54 +0800
committerGitHub <noreply@github.com>2018-12-12 07:48:54 +0800
commit42be1a429fd9286a72e19b782c9b906cb3c0f8ad (patch)
tree123cee2e74c858b7ad7c12dc8f8a6e7ced233f5f /packages/pipeline/migrations
parent96b8100a787d00142dcf875d940c9125571cbde6 (diff)
downloaddexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar.gz
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar.bz2
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar.lz
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar.xz
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.tar.zst
dexon-sol-tools-42be1a429fd9286a72e19b782c9b906cb3c0f8ad.zip
track idex orderbook snapshots (#1397)
* Track Idex and Oasis Orderbook Snapshots
Diffstat (limited to 'packages/pipeline/migrations')
-rw-r--r--packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
new file mode 100644
index 000000000..a501ec6d8
--- /dev/null
+++ b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
@@ -0,0 +1,33 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class TokenOrderbookSnapshotAddOrderType1544131658904 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495",
+ ADD PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address DROP NOT NULL,
+ ALTER COLUMN base_asset_address DROP NOT NULL;
+ `,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address SET NOT NULL,
+ ALTER COLUMN base_asset_address SET NOT NULL;
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT token_orderbook_snapshots_pkey,
+ ADD CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495" PRIMARY KEY (observed_timestamp, source, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ }
+}