summaryrefslogtreecommitdiff
path: root/apps/web/src/services/storage/migrations/transformers/v9-to-v10.ts
blob: 18885b62b2ecb109559c91194b743f8288bf86d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import type { MigrationResult, ProjectRecord } from "./types";
import { getProjectId } from "./utils";

export function transformProjectV9ToV10({
	project,
}: {
	project: ProjectRecord;
}): MigrationResult<ProjectRecord> {
	if (!getProjectId({ project })) {
		return { project, skipped: true, reason: "no project id" };
	}

	if (typeof project.version === "number" && project.version >= 10) {
		return { project, skipped: true, reason: "already v10" };
	}

	return {
		project: { ...project, version: 10 },
		skipped: false,
	};
}