Relative Content

Tag Archive for androidandroid-room

Room migration not executed on empty database

I have Room database within my application with a migration step that read the app private folder and populate the DB accordingly. The migration works well when I run it if the database is not empty.

Why does the UI stop when running database.clearAllTables() in IO?

@Query(“DELETE FROM tableName”) suspend fun resetData() fun startAllDataReset() = viewModelScope.launch(Dispatchers.IO) { dao.resetData() } I initially deleted it as a delete query, but this method also stopped the ui. fun startAllDataReset() = viewModelScope.launch(Dispatchers.IO) { database.clearAllTables() } The second time I tried this method also stops the ui. It stops for about 20 seconds, and then the […]