Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-sdk-libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin authored Feb 7, 2024
2 parents 26c551b + 8d3f051 commit 9139ea3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ data class MigrationConfig(
val rules: List<RuleConfig>,
val version: Int,
val purgeAffectedResources: Boolean = false,
val createLocalChangeEntitiesAfterPurge: Boolean = true,
val resourceFilterExpression: ResourceFilterExpression? = null,
) : java.io.Serializable

Check warning on line 33 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/migration/MigrationConfig.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/migration/MigrationConfig.kt#L25-L33

Added lines #L25 - L33 were not covered by tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ constructor(
if (migrationConfig.purgeAffectedResources) {
defaultRepository.purge(updatedResource as Resource, forcePurge = true)
}
defaultRepository.addOrUpdate(resource = updatedResource as Resource)
if (migrationConfig.createLocalChangeEntitiesAfterPurge) {
defaultRepository.addOrUpdate(resource = updatedResource as Resource)
} else defaultRepository.createRemote(resource = *arrayOf(updatedResource as Resource))
}
}
Timber.i("Data migration completed successfully for version: ${migrationConfig.version}")
Expand Down

0 comments on commit 9139ea3

Please sign in to comment.