Include custom attr table in database cleanup

This commit is contained in:
MM20
2022-09-25 19:24:31 +02:00
parent 41766cc0ac
commit f1dbb84f61
3 changed files with 20 additions and 2 deletions
@@ -33,6 +33,7 @@ interface CustomAttributesRepository {
suspend fun getAllTags(startsWith: String? = null): List<String>
fun getItemsForTag(tag: String): Flow<List<Searchable>>
fun addTag(item: Searchable, tag: String)
suspend fun cleanupDatabase(): Int
}
internal class CustomAttributesRepositoryImpl(
@@ -198,4 +199,14 @@ internal class CustomAttributesRepositoryImpl(
}
}
}
override suspend fun cleanupDatabase(): Int {
val dao = appDatabase.backupDao()
var removed = 0
val job = scope.launch {
removed = dao.cleanUp()
}
job.join()
return removed
}
}