diff options
Diffstat (limited to 'packages/pipeline/src/entities')
-rw-r--r-- | packages/pipeline/src/entities/Block.ts | 9 | ||||
-rw-r--r-- | packages/pipeline/src/entities/Transaction.ts | 11 | ||||
-rw-r--r-- | packages/pipeline/src/entities/block.ts | 10 | ||||
-rw-r--r-- | packages/pipeline/src/entities/transaction.ts | 20 |
4 files changed, 29 insertions, 21 deletions
diff --git a/packages/pipeline/src/entities/Block.ts b/packages/pipeline/src/entities/Block.ts new file mode 100644 index 000000000..49e0ef840 --- /dev/null +++ b/packages/pipeline/src/entities/Block.ts @@ -0,0 +1,9 @@ +import { Column, Entity, PrimaryColumn } from 'typeorm'; + +@Entity() +export class Block { + @PrimaryColumn() public hash!: string; + @PrimaryColumn() public number!: number; + + @Column() public unixTimestampSeconds!: number; +} diff --git a/packages/pipeline/src/entities/Transaction.ts b/packages/pipeline/src/entities/Transaction.ts new file mode 100644 index 000000000..d89d44746 --- /dev/null +++ b/packages/pipeline/src/entities/Transaction.ts @@ -0,0 +1,11 @@ +import { Column, Entity, PrimaryColumn } from 'typeorm'; + +@Entity() +export class Transaction { + @PrimaryColumn() public transactionHash!: string; + @PrimaryColumn() public blockHash!: string; + @PrimaryColumn() public blockNumber!: number; + + @Column() public gasUsed!: number; + @Column() public gasPrice!: number; +} diff --git a/packages/pipeline/src/entities/block.ts b/packages/pipeline/src/entities/block.ts index 398946622..49e0ef840 100644 --- a/packages/pipeline/src/entities/block.ts +++ b/packages/pipeline/src/entities/block.ts @@ -1,13 +1,9 @@ import { Column, Entity, PrimaryColumn } from 'typeorm'; -import { numberToBigIntTransformer } from '../utils'; - -@Entity({ name: 'blocks', schema: 'raw' }) +@Entity() export class Block { @PrimaryColumn() public hash!: string; - @PrimaryColumn({ transformer: numberToBigIntTransformer }) - public number!: number; + @PrimaryColumn() public number!: number; - @Column({ name: 'timestamp', transformer: numberToBigIntTransformer }) - public timestamp!: number; + @Column() public unixTimestampSeconds!: number; } diff --git a/packages/pipeline/src/entities/transaction.ts b/packages/pipeline/src/entities/transaction.ts index 742050177..d89d44746 100644 --- a/packages/pipeline/src/entities/transaction.ts +++ b/packages/pipeline/src/entities/transaction.ts @@ -1,19 +1,11 @@ -import { BigNumber } from '@0x/utils'; import { Column, Entity, PrimaryColumn } from 'typeorm'; -import { bigNumberTransformer, numberToBigIntTransformer } from '../utils'; - -@Entity({ name: 'transactions', schema: 'raw' }) +@Entity() export class Transaction { - @PrimaryColumn({ name: 'transaction_hash' }) - public transactionHash!: string; - @PrimaryColumn({ name: 'block_hash' }) - public blockHash!: string; - @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer }) - public blockNumber!: number; + @PrimaryColumn() public transactionHash!: string; + @PrimaryColumn() public blockHash!: string; + @PrimaryColumn() public blockNumber!: number; - @Column({ type: 'numeric', name: 'gas_used', transformer: bigNumberTransformer }) - public gasUsed!: BigNumber; - @Column({ type: 'numeric', name: 'gas_price', transformer: bigNumberTransformer }) - public gasPrice!: BigNumber; + @Column() public gasUsed!: number; + @Column() public gasPrice!: number; } |