[db] Clarify method documentation for clearing/resetting

This commit is contained in:
Torsten Grote
2023-04-06 08:34:02 -03:00
parent 8f02240419
commit d7b52abf43
2 changed files with 8 additions and 1 deletions

View File

@@ -592,6 +592,11 @@ internal interface AppDaoInt : AppDao {
@Query("SELECT COUNT(*) FROM ${LocalizedFileList.TABLE}")
fun countLocalizedFileLists(): Int
/**
* Removes all apps and associated data such as versions from the database.
* Careful: Doing this without other measures such as calling [RepositoryDaoInt.resetTimestamps]
* will cause application of diffs to fail.
*/
@Query("DELETE FROM ${AppMetadata.TABLE}")
fun clearAll()
}

View File

@@ -15,6 +15,7 @@ import org.fdroid.database.DbDiffUtils.diffAndUpdateListTable
import org.fdroid.database.DbDiffUtils.diffAndUpdateTable
import org.fdroid.index.IndexFormatVersion
import org.fdroid.index.IndexParser.json
import org.fdroid.index.v2.IndexV2Updater
import org.fdroid.index.v2.MirrorV2
import org.fdroid.index.v2.ReflectionDiffer.applyDiff
import org.fdroid.index.v2.RepoV2
@@ -380,7 +381,8 @@ internal interface RepositoryDaoInt : RepositoryDao {
/**
* Resets timestamps for *all* repos in the database.
* This will cause
* This will use a full index instead of diffs
* when updating the repository via [IndexV2Updater].
*/
@Query("UPDATE ${CoreRepository.TABLE} SET timestamp = -1")
fun resetTimestamps()