Skip to content

Commit

Permalink
Fix delete local cloud (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
SailReal committed Oct 22, 2021
1 parent 7add3e5 commit f39cc8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -453,6 +453,10 @@ class UpgradeDatabaseTest {
.integer("POSITION", 11) //
.executeOn(db)

Sql.query("CLOUD_ENTITY").executeOn(db).use {
Assert.assertThat(it.count, CoreMatchers.`is`(5))
}

Upgrade9To10().applyTo(db, 9)

Sql.query("VAULT_ENTITY").executeOn(db).use {
Expand All @@ -462,6 +466,9 @@ class UpgradeDatabaseTest {
Assert.assertThat(it.getString(it.getColumnIndex("FOLDER_CLOUD_ID")), CoreMatchers.nullValue())
}

Sql.query("CLOUD_ENTITY").executeOn(db).use {
Assert.assertThat(it.count, CoreMatchers.`is`(4))
}
}

}
5 changes: 2 additions & 3 deletions data/src/main/java/org/cryptomator/data/db/Upgrade9To10.kt
@@ -1,6 +1,5 @@
package org.cryptomator.data.db

import org.cryptomator.domain.CloudType
import org.greenrobot.greendao.database.Database
import javax.inject.Inject
import javax.inject.Singleton
Expand All @@ -18,8 +17,8 @@ internal class Upgrade9To10 @Inject constructor() : DatabaseUpgrade(9, 10) {
.executeOn(db)

Sql.deleteFrom("CLOUD_ENTITY")
.where("FOLDER_CLOUD_ID", Sql.eq(4))
.where("TYPE", Sql.eq(CloudType.LOCAL.name))
.where("_id", Sql.eq(4))
.where("TYPE", Sql.eq("LOCAL"))
.executeOn(db)

db.setTransactionSuccessful()
Expand Down

0 comments on commit f39cc8d

Please sign in to comment.