diff --git a/src/permissions/note-user-permission.entity.ts b/src/permissions/note-user-permission.entity.ts index b60593a4b..4f73bd6b4 100644 --- a/src/permissions/note-user-permission.entity.ts +++ b/src/permissions/note-user-permission.entity.ts @@ -20,12 +20,14 @@ export class NoteUserPermission { @ManyToOne((_) => User, { primary: true, onDelete: 'CASCADE', // This deletes the NoteUserPermission, when the associated Note is deleted + orphanedRowAction: 'delete', // This ensures the whole row is deleted when the Permission stops being referenced }) user: User; @ManyToOne((_) => Note, (note) => note.userPermissions, { primary: true, onDelete: 'CASCADE', // This deletes the NoteUserPermission, when the associated Note is deleted + orphanedRowAction: 'delete', // This ensures the whole row is deleted when the Permission stops being referenced }) note: Note;