Open alberto-i opened 1 year ago
Overriding the join column "fixed" the problem, removing the unique constraint:
@AuditingEntity(Registration)
export class AuditingRegistration extends Registration implements AuditingEntityDefaultColumns {
readonly _seq: number
readonly _action: AuditingAction
readonly _modifiedAt: Date
@Column({ nullable: true })
approvalId: string
}
Edit: Actually it didn't:
column "approvalId" specified more than once
Hi
did you find a solution?
Thank you!
Environment
When an entity has a OneToOne relationship, TypeORM will create a unique index for the foreign key column. The inherited auditing entity also creates this unique index, and after trying to save a second record to the auditing table, we get a "duplicate key value violates unique constraint"
Steps to reproduce: