diff --git a/server/src/external/mongo/schemas.ts b/server/src/external/mongo/schemas.ts index 1cf4ce981..4ec378d81 100644 --- a/server/src/external/mongo/schemas.ts +++ b/server/src/external/mongo/schemas.ts @@ -725,4 +725,18 @@ export const DatabaseSchemas: Record< playtype: isValidPlaytype, milestones: ["string"], }), + migrations: prSchemaify({ + migrationID: "string", + status: p.isIn("applied", "pending"), + appliedOn: (self, parent) => { + if (parent.status === "pending") { + return ( + self === undefined || + `Expected appliedOn to be undefined since status was pending.` + ); + } + + return p.isPositiveInteger(self); + }, + }), };