Split up FlexibleKeyItem, re-add support for dummy item if user has no secret keys

This commit is contained in:
Vincent Breitmoser
2018-06-21 14:24:52 +02:00
parent 377bf55b70
commit b4ac6cd337
9 changed files with 359 additions and 242 deletions

View File

@@ -453,12 +453,28 @@ public class KeychainDatabase {
}
private void migrateUpdatedKeysToKeyMetadataTable(SupportSQLiteDatabase db) {
db.execSQL("ALTER TABLE updated_keys RENAME TO key_metadata;");
db.execSQL("UPDATE key_metadata SET last_updated = last_updated * 1000;");
try {
db.execSQL("ALTER TABLE updated_keys RENAME TO key_metadata;");
db.execSQL("UPDATE key_metadata SET last_updated = last_updated * 1000;");
} catch (SQLException e) {
if (Constants.DEBUG) {
Timber.e(e, "Ignoring migration exception, this probably happened before");
return;
}
throw e;
}
}
private void renameApiAutocryptPeersTable(SupportSQLiteDatabase db) {
db.execSQL("ALTER TABLE api_autocrypt_peers RENAME TO autocrypt_peers;");
try {
db.execSQL("ALTER TABLE api_autocrypt_peers RENAME TO autocrypt_peers;");
} catch (SQLException e) {
if (Constants.DEBUG) {
Timber.e(e, "Ignoring migration exception, this probably happened before");
return;
}
throw e;
}
}
public void onDowngrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {