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

Commit

Permalink
Fix v2 to v3 Database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed May 5, 2020
1 parent a085a98 commit 12fdd57
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions app/src/common/shared/org/mozilla/vrbrowser/db/AppDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static AppDatabase getAppDatabase(Context context, final AppExecutors exe
@NonNull
private static AppDatabase buildDatabase(final @NonNull Context appContext, final @NonNull AppExecutors executors) {
return Room.databaseBuilder(appContext, AppDatabase.class, DATABASE_NAME)
.addMigrations(MIGRATION_1_2)
.addMigrations(MIGRATION_1_2, MIGRATION_2_3)
.addCallback(new Callback() {
@Override
public void onCreate(@NonNull SupportSQLiteDatabase db) {
Expand Down Expand Up @@ -87,15 +87,6 @@ public void migrate(SupportSQLiteDatabase database) {
}
};

private static final Migration MIGRATION_1_3 = new Migration(1, 3) {
@Override
public void migrate(SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE PopUpSite RENAME TO SitePermission");
database.execSQL("ALTER TABLE SitePermission ADD COLUMN category INTEGER NOT NULL DEFAULT 0");
database.execSQL("ALTER TABLE SitePermission ADD COLUMN principal STRING NOT NULL DEFAULT ''");
}
};

private static final Migration MIGRATION_2_3 = new Migration(2, 3) {
@Override
public void migrate(SupportSQLiteDatabase database) {
Expand Down

0 comments on commit 12fdd57

Please sign in to comment.