-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix backwards compatibility of migrations
- Loading branch information
1 parent
0afa5db
commit 757ef75
Showing
3 changed files
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 14 additions & 9 deletions
23
zod-models/src/allProjectsDataExport/allProjectsDataExportSchema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import {z} from 'zod' | ||
import { z } from 'zod' | ||
import ProfileSchema from '../profile/profileSchema' | ||
import ProjectExportDataV1Schema from '../projectExportData/projectExportDataSchema' | ||
import ProjectExportDataSchema, { | ||
BackwardsCompatibleProjectExportSchema, | ||
} from '../projectExportData/projectExportDataSchema' | ||
|
||
// this is the one that requires backwards compatibility | ||
// it's the one that gets used for importing | ||
export const BackwardsCompatibleAllProjectsExportSchema = z.object({ | ||
myProfile: ProfileSchema, | ||
projects: z.array(ProjectExportDataV1Schema), | ||
projects: z.array(BackwardsCompatibleProjectExportSchema), | ||
integrityVersion: z.number().optional(), | ||
}) | ||
export type BackwardsCompatibleAllProjectsExport = z.infer< | ||
typeof BackwardsCompatibleAllProjectsExportSchema | ||
> | ||
|
||
export type BackwardsCompatibleAllProjectsExport = z.infer<typeof BackwardsCompatibleAllProjectsExportSchema> | ||
|
||
// this is designed for whatever the current/latest version is. | ||
export const AllProjectsDataExportSchema = z.object({ | ||
myProfile: ProfileSchema, | ||
projects: z.array(ProjectExportDataV1Schema), | ||
projects: z.array(ProjectExportDataSchema), | ||
integrityVersion: z.number(), | ||
}) | ||
|
||
export type AllProjectsDataExport = z.infer<typeof AllProjectsDataExportSchema> | ||
|
||
export default AllProjectsDataExportSchema | ||
export default AllProjectsDataExportSchema |