diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-11-15 07:58:36 +0800 |
---|---|---|
committer | Fred Carlsen <fred@sjelfull.no> | 2018-12-06 19:04:25 +0800 |
commit | 8cb6c2b51ba7c63951f4b87fac423a19861bf47f (patch) | |
tree | e7151a082fe7c5262a53e4408832c61cfeeb82a8 /packages/pipeline/src/utils | |
parent | 1f87bd8cf68d756931f80d39dcdb4d66f76d8e8c (diff) | |
download | dexon-sol-tools-8cb6c2b51ba7c63951f4b87fac423a19861bf47f.tar.gz dexon-sol-tools-8cb6c2b51ba7c63951f4b87fac423a19861bf47f.tar.zst dexon-sol-tools-8cb6c2b51ba7c63951f4b87fac423a19861bf47f.zip |
Change some column types from varchar to numeric
Diffstat (limited to 'packages/pipeline/src/utils')
-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(); |