aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-12-11 08:10:49 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-12-11 08:10:49 +0800
commite72742f1f76dd3b46976ed3d0f272b539bdfb229 (patch)
tree968debeda7e6efcabd58c7218d5dff05dc24f357 /packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
parent928b253c81971eb6f59efd09ab6a9063d4e6e4ca (diff)
parent253bf4df6a6909d8bd65361c0d115e9d1a8e489e (diff)
downloaddexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.gz
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.bz2
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.lz
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.xz
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.tar.zst
dexon-sol-tools-e72742f1f76dd3b46976ed3d0f272b539bdfb229.zip
Merge branch 'development' into feature/contracts-monorepo-7
Diffstat (limited to 'packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts')
-rw-r--r--packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts b/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
new file mode 100644
index 000000000..5200ef7cc
--- /dev/null
+++ b/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
@@ -0,0 +1,53 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class ConvertBigNumberToNumeric1542234704666 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_fill_events
+ ALTER COLUMN maker_asset_filled_amount TYPE numeric USING maker_asset_filled_amount::numeric,
+ ALTER COLUMN taker_asset_filled_amount TYPE numeric USING taker_asset_filled_amount::numeric,
+ ALTER COLUMN maker_fee_paid TYPE numeric USING maker_fee_paid::numeric,
+ ALTER COLUMN taker_fee_paid TYPE numeric USING taker_fee_paid::numeric;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_up_to_events
+ ALTER COLUMN order_epoch TYPE numeric USING order_epoch::numeric;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ ALTER COLUMN maker_asset_amount TYPE numeric USING maker_asset_amount::numeric,
+ ALTER COLUMN taker_asset_amount TYPE numeric USING taker_asset_amount::numeric,
+ ALTER COLUMN maker_fee TYPE numeric USING maker_fee::numeric,
+ ALTER COLUMN taker_fee TYPE numeric USING taker_fee::numeric,
+ ALTER COLUMN expiration_time_seconds TYPE numeric USING expiration_time_seconds::numeric,
+ ALTER COLUMN salt TYPE numeric USING salt::numeric;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ ALTER COLUMN maker_asset_amount TYPE varchar USING maker_asset_amount::varchar,
+ ALTER COLUMN taker_asset_amount TYPE varchar USING taker_asset_amount::varchar,
+ ALTER COLUMN maker_fee TYPE varchar USING maker_fee::varchar,
+ ALTER COLUMN taker_fee TYPE varchar USING taker_fee::varchar,
+ ALTER COLUMN expiration_time_seconds TYPE varchar USING expiration_time_seconds::varchar,
+ ALTER COLUMN salt TYPE varchar USING salt::varchar;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_up_to_events
+ ALTER COLUMN order_epoch TYPE varchar USING order_epoch::varchar;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_fill_events
+ ALTER COLUMN maker_asset_filled_amount TYPE varchar USING maker_asset_filled_amount::varchar,
+ ALTER COLUMN taker_asset_filled_amount TYPE varchar USING taker_asset_filled_amount::varchar,
+ ALTER COLUMN maker_fee_paid TYPE varchar USING maker_fee_paid::varchar,
+ ALTER COLUMN taker_fee_paid TYPE varchar USING taker_fee_paid::varchar;`,
+ );
+ }
+}