我已经在这上面呆了一个小时了,不幸的是在文件里找不到任何相关的东西。
我无法在使用以下类型的字段上设置值
enum
或
uuid
. 例如:
export enum PhotoStatus {
WORKING = 'WORKING',
DONE = 'DONE'
}
export class Photo {
@PrimaryGeneratedColumn()
id: number:
@Column()
size: string;
@Column({
type: 'enum',
enum: PhotoStatus,
default: PhotoStatus.WORKING,
})
status: PhotoStatus;
}
但当我试图创造一个新的记录时,就像这样:
const photo = new Photo();
photo.size = 'huge';
photo.status = PhotoStatus.DONE;
await connection.manager.save(photo);
它抛出一个错误:
BadRequestException: ERROR: column "status" is of type content_status_enum but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
uuid列也会发生这种情况。