Skip to content

Commit

Permalink
Migration for isDeveloper and isTesterMode
Browse files Browse the repository at this point in the history
  • Loading branch information
devkudasov committed Dec 4, 2024
1 parent 682a62b commit f2575a7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,32 @@ export const realm = new Realm({
value: boolean;
}>('VariablesBool');

let removeIndex = -1;
for (const objectIndex in oldObjects) {
const newObject = newObjects[objectIndex];

if (newObject.id === 'isDeveloper' || newObject.id === 'isTesterMode') {
//@ts-ignore
delete newObject[objectIndex];
if (newObject.id === 'isDeveloper') {
removeIndex = objectIndex as never as number;
}
}

if (removeIndex !== -1) {
newObjects.slice(removeIndex, removeIndex + 1);
}

removeIndex = -1;
for (const objectIndex in oldObjects) {
const newObject = newObjects[objectIndex];

if (newObject.id === 'isTesterMode') {
removeIndex = objectIndex as never as number;
}
}

if (removeIndex !== -1) {
newObjects.slice(removeIndex, removeIndex + 1);
}

logger.log({
oldObjects: oldObjects.toJSON(),
newObjects: newObjects.toJSON(),
Expand Down

0 comments on commit f2575a7

Please sign in to comment.