1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 01:06:04 +00:00

Backward compatibility

This commit is contained in:
M66B 2019-12-22 08:43:36 +01:00
parent 95eeaf95a9
commit dbc24f8bdf
2 changed files with 2038 additions and 1 deletions

File diff suppressed because it is too large Load diff

View file

@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 124,
version = 125,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1204,6 +1204,19 @@ public abstract class DB extends RoomDatabase {
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();
}