diff --git a/app/src/main/java/com/geeksville/mesh/database/NodeRepository.kt b/app/src/main/java/com/geeksville/mesh/database/NodeRepository.kt index 63bb049c4..81d312a36 100644 --- a/app/src/main/java/com/geeksville/mesh/database/NodeRepository.kt +++ b/app/src/main/java/com/geeksville/mesh/database/NodeRepository.kt @@ -118,6 +118,7 @@ class NodeRepository @Inject constructor( suspend fun deleteNode(num: Int) = withContext(dispatchers.io) { nodeInfoDao.deleteNode(num) + nodeInfoDao.deleteMetadata(num) } suspend fun insertMetadata(metadata: MetadataEntity) = withContext(dispatchers.io) { diff --git a/app/src/main/java/com/geeksville/mesh/database/dao/NodeInfoDao.kt b/app/src/main/java/com/geeksville/mesh/database/dao/NodeInfoDao.kt index 7b0277462..c186325e1 100644 --- a/app/src/main/java/com/geeksville/mesh/database/dao/NodeInfoDao.kt +++ b/app/src/main/java/com/geeksville/mesh/database/dao/NodeInfoDao.kt @@ -30,6 +30,7 @@ import com.geeksville.mesh.database.entity.NodeWithRelations import com.geeksville.mesh.database.entity.NodeEntity import kotlinx.coroutines.flow.Flow +@Suppress("TooManyFunctions") @Dao interface NodeInfoDao { @@ -117,4 +118,7 @@ interface NodeInfoDao { @Upsert fun upsert(meta: MetadataEntity) + + @Query("DELETE FROM metadata WHERE num=:num") + fun deleteMetadata(num: Int) }