Skip to content

Commit 1b86726

Browse files
ashishkumar468misaochan
authored andcommitted
updated database version and added associated tests
1 parent ab4fca5 commit 1b86726

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/src/main/java/fr/free/nrw/commons/data/DBOpenHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
public class DBOpenHelper extends SQLiteOpenHelper {
1515

1616
private static final String DATABASE_NAME = "commons.db";
17-
private static final int DATABASE_VERSION = 9;
17+
private static final int DATABASE_VERSION = 10;
1818

1919
/**
2020
* Do not use directly - @Inject an instance where it's needed and let

app/src/test/kotlin/fr/free/nrw/commons/contributions/ContributionDaoTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ class ContributionDaoTest {
126126
}
127127
}
128128

129+
@Test
130+
fun migrateTableVersionFrom_v9_to_v10() {
131+
Table.onUpdate(database, 8, 9)
132+
// Table changed in version 9
133+
inOrder(database) {
134+
verify<SQLiteDatabase>(database).execSQL(Table.ADD_WIKI_DATA_ENTITY_ID_FIELD)
135+
}
136+
}
137+
129138
@Test
130139
fun saveNewContribution_nonNullFields() {
131140
whenever(client.insert(isA(), isA())).thenReturn(contentUri)

0 commit comments

Comments
 (0)