diff --git a/src/Schema.js b/src/Schema.js index a8b56bf..a571616 100644 --- a/src/Schema.js +++ b/src/Schema.js @@ -188,7 +188,7 @@ const entities = [ function createRealmConfig() { return { //order is important, should be arranged according to the dependency - schemaVersion: 179, + schemaVersion: 180, onMigration: function (oldDB, newDB) { console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`); if (oldDB.schemaVersion < 10) { @@ -797,6 +797,15 @@ function createRealmConfig() { } }); } + if (oldDB.schemaVersion < 180) { + General.logDebug("Migration180", "Migration execution started") + const individualsOfInterest = newDB.objects(Individual.schema.name).filtered("lowestAddressLevel = null"); + _.forEach(individualsOfInterest, (individual) => { + General.logDebug("Migration180", "Deleting individual " + individual.uuid) + newDB.delete(individual) + }) + General.logDebug("Migration180", "Migration execution completed") + } }, }; }