From 4d57105853d5b273e587abfb0cc04069cebb3e96 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Thu, 18 Nov 2021 18:08:29 +0100 Subject: [PATCH] docs(history-entry): document why we can't lazy-load Signed-off-by: David Mehren --- src/history/history-entry.entity.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/history/history-entry.entity.ts b/src/history/history-entry.entity.ts index 053822312..481c6b9ea 100644 --- a/src/history/history-entry.entity.ts +++ b/src/history/history-entry.entity.ts @@ -10,6 +10,13 @@ import { User } from '../users/user.entity'; @Entity() export class HistoryEntry { + /** + * The `user` and `note` properties cannot be converted to promises + * (to lazy-load them), as TypeORM gets confused about lazy composite + * primary keys. + * See https://github.com/typeorm/typeorm/issues/6908 + */ + @ManyToOne((_) => User, (user) => user.historyEntries, { onDelete: 'CASCADE', primary: true,