diff --git a/src/lib/documents/tombstones.ts b/src/lib/documents/tombstones.ts index 7ca5e337d..f6ee18c9d 100644 --- a/src/lib/documents/tombstones.ts +++ b/src/lib/documents/tombstones.ts @@ -45,6 +45,8 @@ export const SOURCE_KEY_SELECT = { sourceId: true, sourceInstance: true, sourceAliases: { + // The backup reads through this select, and its export is totally ordered. + orderBy: [{ createdAt: "asc" }, { id: "asc" }], select: { sourceSystem: true, sourceId: true, sourceInstance: true }, }, } as const;