Backward compatibility

pull/170/head
M66B 5 years ago
parent 95eeaf95a9
commit dbc24f8bdf

File diff suppressed because it is too large Load Diff

@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 124, version = 125,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.class, EntityAccount.class,
@ -1204,6 +1204,19 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `identity` ADD COLUMN `provider` TEXT"); db.execSQL("ALTER TABLE `identity` ADD COLUMN `provider` TEXT");
} }
}) })
.addMigrations(new Migration(124, 125) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int previous_version = prefs.getInt("previous_version", -1);
if (previous_version <= 848 && Helper.isPlayStoreInstall()) {
// JavaMail didn't check server certificates
db.execSQL("UPDATE account SET insecure = 1 WHERE auth_type = " + MailService.AUTH_TYPE_PASSWORD);
db.execSQL("UPDATE identity SET insecure = 1 WHERE auth_type = " + MailService.AUTH_TYPE_PASSWORD);
}
}
})
.build(); .build();
} }

Loading…
Cancel
Save