QUERY FAILED ERROR: THE COLUMN “PRICE” CONTAIN NULL VALUES – TYPEORM – POSTGRESQL

QUERY FAILED ERROR: THE COLUMN “PRICE” CONTAIN NULL VALUES – TYPEORM – POSTGRESQL

I had this entity

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

@Entity()
export class User {

@PrimaryGeneratedColumn()
id!: number;

@Column('text')
firstName!: string;

}
and I was getting the error “column “firstName” contains null values.” So I added {nullable: true} as @pleerock suggested here https://github.com/typeorm/typeorm/issues/845 and it worked.

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

@Entity()
export class User {

@PrimaryGeneratedColumn()
id!: number;

@Column('text', {nullable: true})
firstName: string;

}

IN CONCLUSION

I think TypeORM is a good alternative for smal and medium proyects. Currently I am working with another ORM which has givento developers better results for scalable apps.

SUPPORT

If you need me for a consultation or to create a PostgreSQL Database with NestJS, contact me via admin@domiserver.com

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

AFILIATE A DOMISERVER


 
 
 

¿No sabes por donde empezar?