Skip to content

Commit

Permalink
update db version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaybadgujar102 committed Dec 17, 2024
1 parent cd1dcc2 commit 648ffe1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 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 = 22;
export const dexieVersion = 23;

const currentVersion = Number(localStorage.getItem(LocalStorageKeys.DEXIE_VERSION) || dexieVersion);
localStorage.setItem(LocalStorageKeys.DEXIE_VERSION, `${dexieVersion}`);
Expand Down
13 changes: 12 additions & 1 deletion src/models/dexie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const syncVersion = (transaction: Transaction, currentVersion: number) =>
const taskCollection = transaction.table("taskCollection");
taskCollection.toCollection().modify((task: TaskItem) => {
task.blockedSlots = [];
task.completedTodayIds = [];
});
}
if (currentVersion < 12) {
Expand Down Expand Up @@ -170,4 +169,16 @@ export const syncVersion = (transaction: Transaction, currentVersion: number) =>
delete task.completedTodayTimings;
});
}
if (currentVersion < 23) {
console.log("processing updates for 23th version");
const taskCollection = transaction.table("taskCollection");
taskCollection.toCollection().modify((task) => {
delete task.completedTodayIds;
delete task.completedToday;
delete task.lastCompleted;
delete task.lastSkipped;
delete task.hoursSpent;
delete task.skippedToday;
});
}
};

0 comments on commit 648ffe1

Please sign in to comment.