private fun savetosqlite(CoinListesi: List<CoinInfo>){
launch{
val dao = CoinInfoDatabase(getApplication()).CoinDao()
dao.deleteAll()
val uuidList= dao.insertAll(*CoinListesi.toTypedArray())
}
dao is reset but primary key keeps increasing every time the function is called, also primary key doesn't start from 0 how do I solve it?
Dao
@Dao
interface CoinInfoDao {
@Insert
suspend fun insertAll(vararg CoinInfo: CoinInfo):List<Long>
@Query("DELETE FROM CoinInfo")
suspend fun deleteAll() }
model
@Entity
data class CoinInfo (...){
@PrimaryKey(autoGenerate = true)
var uuid:Int=0
}