Open kamal-mnrb opened 1 year ago
@kamal-mnrb Thanks for reporting the bug. Sorry for the late reply, I was on vacation. I'll try to figure out the problem.
@kamal-mnrb I tested it and it works fine for boolean columns. Could you please show me the code to save the origin entity?
Environment
Describe the bug I have a user entity with "status" column, which is a boolean
@Column({ default: true, }) status: boolean;
When i tried to insert data, the auditing try inserting "1" or "0", then it returns error
QueryFailedError: invalid input value for enum audit_trail.auditing_user_status_enum: "0" at PostgresQueryRunner.query (~/project/node_modules/typeorm/src/driver/postgres/PostgresQueryRunner.ts:299:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async InsertQueryBuilder.execute (~/project/node_modules/src/query-builder/InsertQueryBuilder.ts:163:33) at async SubjectExecutor.executeInsertOperations (~/project/node_modules/src/persistence/SubjectExecutor.ts:428:42) at async SubjectExecutor.execute (~/project/node_modules/src/persistence/SubjectExecutor.ts:137:9) at async EntityPersistExecutor.execute (~/project/node_modules/src/persistence/EntityPersistExecutor.ts:194:21) { query: 'INSERT INTO "audit_trail"."auditing_user"("_action", "_modified_at", "id", "status", "first_name", "last_name", "gender", "race", "birthday", "phone", "email", "image", "id_no", "farm_no", "additional_info", "settings", "sepakat_id", "created_at", "updated_at", "address_id") VALUES ($1, DEFAULT, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, DEFAULT) RETURNING "_seq", "_modified_at", "status"', parameters: [ 'Create', 1, 0, 'Super Admin', 'Super Admin', 'male', 'race', '1987-02-02', '0111111111', null, null, null, null, null, null, '11-1111-11-1111', 2022-12-28T22:13:54.593Z, 2022-12-28T22:13:54.593Z ], driverError: error: invalid input value for enum audit_trail.auditing_user_status_enum: "0" at Parser.parseErrorMessage (~/project/node_modules/pg-protocol/src/parser.ts:369:69) at Parser.handlePacket (~/project/node_modules/pg-protocol/src/parser.ts:188:21) at Parser.parse (~/project/node_modules/pg-protocol/src/parser.ts:103:30) at Socket. (~/project/node_modules/pg-protocol/src/index.ts:7:48)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 121,
severity: 'ERROR',
code: '22P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'enum.c',
line: '129',
routine: 'enum_in'
},
length: 121,
severity: 'ERROR',
code: '22P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'enum.c',
line: '129',
routine: 'enum_in'
}