aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/migrations
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-11-15 07:58:36 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-12-05 06:24:48 +0800
commit303bbc42f4322448998f3fde202574335d1190e6 (patch)
treeb0a45e28d54fef51d237ff32352dd82c891419cf /packages/pipeline/migrations
parent10e93bb01ffcf029821430781ef582a24901a461 (diff)
downloaddexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.gz
dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.zst
dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.zip
Change some column types from varchar to numeric
Diffstat (limited to 'packages/pipeline/migrations')
-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;`,
+ );
+ }
+}