Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit fb0babb

Browse files
authored
Fix Database crash between v10 versions (#3345)
1 parent 04d5517 commit fb0babb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/src/common/shared/org/mozilla/vrbrowser/db/AppDatabase.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import org.mozilla.vrbrowser.AppExecutors;
1515

16-
@Database(entities = {SitePermission.class}, version = 3)
16+
@Database(entities = {SitePermission.class}, version = 4)
1717
public abstract class AppDatabase extends RoomDatabase {
1818

1919
private static final String DATABASE_NAME = "app";
@@ -38,7 +38,7 @@ public static AppDatabase getAppDatabase(Context context, final AppExecutors exe
3838
@NonNull
3939
private static AppDatabase buildDatabase(final @NonNull Context appContext, final @NonNull AppExecutors executors) {
4040
return Room.databaseBuilder(appContext, AppDatabase.class, DATABASE_NAME)
41-
.addMigrations(MIGRATION_1_2, MIGRATION_2_3)
41+
.addMigrations(MIGRATION_1_2, MIGRATION_2_4)
4242
.addCallback(new Callback() {
4343
@Override
4444
public void onCreate(@NonNull SupportSQLiteDatabase db) {
@@ -87,7 +87,8 @@ public void migrate(SupportSQLiteDatabase database) {
8787
}
8888
};
8989

90-
private static final Migration MIGRATION_2_3 = new Migration(2, 3) {
90+
// Note: We skip version 3 as a workaround to fix a crash between v10 releases
91+
private static final Migration MIGRATION_2_4 = new Migration(2, 4) {
9192
@Override
9293
public void migrate(SupportSQLiteDatabase database) {
9394
database.execSQL("ALTER TABLE SitePermission ADD COLUMN principal TEXT NOT NULL DEFAULT ''");

0 commit comments

Comments
 (0)