Skip to content

Commit ad6cf55

Browse files
committed
fix: delete all rows instead of dropping tables when clearing data
1 parent dbbd762 commit ad6cf55

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/kotlin/com/sakethh/linkora/data/repository/SyncRepoImpl.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlinx.coroutines.async
1515
import kotlinx.coroutines.awaitAll
1616
import kotlinx.coroutines.coroutineScope
1717
import kotlinx.serialization.json.Json
18-
import org.jetbrains.exposed.sql.SchemaUtils
18+
import org.jetbrains.exposed.sql.deleteAll
1919
import org.jetbrains.exposed.sql.selectAll
2020
import org.jetbrains.exposed.sql.transactions.transaction
2121

@@ -117,7 +117,9 @@ class SyncRepoImpl : SyncRepo {
117117
override suspend fun deleteEverything(): Result<Unit> {
118118
return try {
119119
transaction {
120-
SchemaUtils.drop(*linkoraTables())
120+
linkoraTables().forEach {
121+
it.deleteAll()
122+
}
121123
}
122124
Result.success(Unit)
123125
} catch (e: Exception) {

0 commit comments

Comments
 (0)