Skip to content

Commit

Permalink
update db version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaybadgujar102 committed Oct 22, 2024
1 parent 470ae54 commit 8b92ade
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/models/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { dbStoreSchema, syncVersion } from "./dexie";
import { TaskHistoryItem } from "./TaskHistoryItem";
import { TasksDoneTodayItem } from "./TasksDoneTodayItem";

export const dexieVersion = 21;
export const dexieVersion = 22;

const currentVersion = Number(localStorage.getItem(LocalStorageKeys.DEXIE_VERSION) || dexieVersion);
localStorage.setItem(LocalStorageKeys.DEXIE_VERSION, `${dexieVersion}`);
Expand Down
11 changes: 9 additions & 2 deletions src/models/dexie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,15 @@ export const syncVersion = (transaction: Transaction, currentVersion: number) =>
if (currentVersion < 21) {
console.log("processing updates for 20th version");
const taskCollection = transaction.table("taskCollection");
taskCollection.toCollection().modify((task: TaskItem) => {
// task.completedTodayTimings = [];
taskCollection.toCollection().modify((task) => {
task.completedTodayTimings = [];
});
}
if (currentVersion < 22) {
console.log("processing updates for 22th version");
const taskCollection = transaction.table("taskCollection");
taskCollection.toCollection().modify((task) => {
delete task.completedTodayTimings;
});
}
};

0 comments on commit 8b92ade

Please sign in to comment.