I have the Users entity:
id|name |age|images
1 | John | 4 | {123.jpg,258.png}
I want to delete an image from images column. According to typeorm documentation i can use:
import {getConnection} from "typeorm";
await getConnection()
.createQueryBuilder()
.delete()
.from(Users)
.where("id = :id", { id: 1 })
.execute();
If use this i will delete the whole entity, but i need just to delete 123.jpg from images column.
Question: How to delete 123.jpg image from images column?
Note: I use NestJs and ProgresQl
Users entity:
@Entity()
export class Users {
@PrimaryGeneratedColumn()
id: number;
...
@Column("text",{nullable: true, array: true})
images: string[];
}
imagesjust a colmun in User entity? please share The user entity