Skip to content

Commit

Permalink
migrations for tutanota-v79.ts and sys-v116.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wrdhub committed Dec 12, 2024
1 parent 9033fd9 commit 9848287
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/api/worker/offline/OfflineStorageMigrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { tutanota77 } from "./migrations/tutanota-v77.js"
import { sys114 } from "./migrations/sys-v114.js"
import { offline2 } from "./migrations/offline2.js"
import { sys115 } from "./migrations/sys-v115.js"
import { sys116 } from "./migrations/sys-v116.js"
import { tutanota79 } from "./migrations/tutanota-v79.js"

export interface OfflineMigration {
readonly app: VersionMetadataBaseKey
Expand Down Expand Up @@ -82,6 +84,8 @@ export const OFFLINE_STORAGE_MIGRATIONS: ReadonlyArray<OfflineMigration> = [
sys114,
offline2,
sys115,
sys116,
tutanota79,
]

const CURRENT_OFFLINE_VERSION = 2
Expand Down
9 changes: 9 additions & 0 deletions src/common/api/worker/offline/migrations/sys-v116.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { OfflineMigration } from "../OfflineStorageMigrator.js"
import { OfflineStorage } from "../OfflineStorage.js"
export const sys116: OfflineMigration = {
app: "sys",
version: 116,
async migrate(storage: OfflineStorage) {
// only Downgraded customer was added so nothing to migrate
},
}
13 changes: 13 additions & 0 deletions src/common/api/worker/offline/migrations/tutanota-v79.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { OfflineMigration } from "../OfflineStorageMigrator.js"
import { OfflineStorage } from "../OfflineStorage.js"
import { addValue, migrateAllElements } from "../StandardMigrations"
import { MailBoxTypeRef } from "../../../entities/tutanota/TypeRefs"
import { GENERATED_MIN_ID } from "../../../common/utils/EntityUtils"

export const tutanota79: OfflineMigration = {
app: "tutanota",
version: 79,
async migrate(storage: OfflineStorage) {
await migrateAllElements(MailBoxTypeRef, storage, [addValue("importedAttachments", GENERATED_MIN_ID), addValue("mailImportStates", GENERATED_MIN_ID)])
},
}

0 comments on commit 9848287

Please sign in to comment.