diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-15 07:58:36 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-12-05 06:24:48 +0800 |
commit | 303bbc42f4322448998f3fde202574335d1190e6 (patch) | |
tree | b0a45e28d54fef51d237ff32352dd82c891419cf /packages/pipeline/src/utils/index.ts | |
parent | 10e93bb01ffcf029821430781ef582a24901a461 (diff) | |
download | dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.gz dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.bz2 dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.lz dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.xz dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.tar.zst dexon-sol-tools-303bbc42f4322448998f3fde202574335d1190e6.zip |
Change some column types from varchar to numeric
Diffstat (limited to 'packages/pipeline/src/utils/index.ts')
-rw-r--r-- | packages/pipeline/src/utils/index.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/pipeline/src/utils/index.ts b/packages/pipeline/src/utils/index.ts index a083cd8c9..78aa89374 100644 --- a/packages/pipeline/src/utils/index.ts +++ b/packages/pipeline/src/utils/index.ts @@ -1,4 +1,5 @@ import { BigNumber } from '@0x/utils'; +import { ValueTransformer } from 'typeorm/decorator/options/ValueTransformer'; /** * If the given BigNumber is not null, returns the string representation of that @@ -34,3 +35,17 @@ export function handleError(e: any): void { } process.exit(1); } + +class BigNumberTransformer implements ValueTransformer { + // tslint:disable-next-line:prefer-function-over-method + public to(value: BigNumber): string { + return value.toString(); + } + + // tslint:disable-next-line:prefer-function-over-method + public from(value: string): BigNumber { + return new BigNumber(value); + } +} + +export const bigNumberTransformer = new BigNumberTransformer(); |