Set expiry to NULL where it was 0L, hopefully fixing migration issues

This commit is contained in:
Vincent Breitmoser 2018-07-24 14:00:21 +02:00
parent df204daece
commit c8f730ced8
1 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,7 @@ import timber.log.Timber;
*/
public class KeychainDatabase {
private static final String DATABASE_NAME = "openkeychain.db";
private static final int DATABASE_VERSION = 30;
private static final int DATABASE_VERSION = 31;
private final SupportSQLiteOpenHelper supportSQLiteOpenHelper;
private static KeychainDatabase sInstance;
@ -363,9 +363,16 @@ public class KeychainDatabase {
case 29:
recreateUnifiedKeyView(db);
case 30:
fixKeyExpiries(db);
}
}
private void fixKeyExpiries(SupportSQLiteDatabase db) {
db.execSQL("UPDATE keys SET expiry = NULL WHERE expiry = 0;");
}
private void recreateUnifiedKeyView(SupportSQLiteDatabase db) {
try {
db.beginTransaction();