Identify certificates by fingerprint

This commit is contained in:
M66B
2019-12-04 10:45:53 +01:00
parent d92777b692
commit a2bb26e086
5 changed files with 2021 additions and 18 deletions

View File

@@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 117,
version = 118,
entities = {
EntityIdentity.class,
EntityAccount.class,
@@ -1140,6 +1140,21 @@ public abstract class DB extends RoomDatabase {
db.execSQL("CREATE INDEX IF NOT EXISTS `index_certificate_email` ON `certificate` (`email`)");
}
})
.addMigrations(new Migration(117, 118) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("DROP TABLE IF EXISTS `certificate`");
db.execSQL("CREATE TABLE IF NOT EXISTS `certificate`" +
" (`id` INTEGER PRIMARY KEY AUTOINCREMENT" +
", `fingerprint` TEXT NOT NULL" +
", `email` TEXT NOT NULL" +
", `subject` TEXT" +
", `data` TEXT NOT NULL)");
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_certificate_fingerprint_email` ON `certificate` (`fingerprint`, `email`)");
db.execSQL("CREATE INDEX IF NOT EXISTS `index_certificate_email` ON `certificate` (`email`)");
}
})
.build();
}