nestjstypeorm

How to store big int in nest js using typeorm


some.entity.ts

amount:number

But when I store a very large data in my postgres it throws error '''integer out of range'''

My question is how can I store Big Int as type in psql using typeorm


Solution

  • Define type bigint in @Column decorator,

    @Column({type: 'bigint'})
    columnName: string;
    

    Note: that based on TypeOrm documentation bigint is mapped to string.