import type { MigrationResult, ProjectRecord } from "./types"; import { getProjectId } from "./utils"; /** * v31 → v32 introduces the `projectVersions` store (named checkpoints + * auto-checkpoints; see notes/project-versioning.md). The store lives in its * own IndexedDB database created lazily by the versions adapter, so project * records need no shape change — this migration only stamps the new version. */ export function transformProjectV31ToV32({ project, }: { project: ProjectRecord; }): MigrationResult { if (!getProjectId({ project })) { return { project, skipped: true, reason: "no project id" }; } const version = project.version; if (typeof version !== "number") { return { project, skipped: true, reason: "invalid version" }; } if (version >= 32) { return { project, skipped: true, reason: "already v32" }; } if (version !== 31) { return { project, skipped: true, reason: "not v31" }; } return { project: { ...project, version: 32 }, skipped: false }; }