QueryFailedError: the column "price" contain null values - TypeORM - PostgreSQL
12:24 28 Aug 2018

I've created a simple table:

import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"

@Entity()
export class Test {
    @PrimaryGeneratedColumn()
    public id!: number

    @Column({ nullable: false })
    public name!: string

    @Column({ nullable: false, type: "float" })
    public price!: number
}

I generate the migration and run it also. When I have no data in the database and I run the server it succeed. But when I add 1 row in the database and I run it again it appears the following error:

QueryFailedError: the column «price» contain null values

The databse definetely has the row with all the data. I tried a lot of cases and none of them was correct.

Has anybody some idea for it?

node.js postgresql typescript typeorm