mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-25 09:17:58 +00:00
Migrate encrypt flag
This commit is contained in:
parent
676342e66d
commit
dd81823fea
1 changed files with 11 additions and 1 deletions
|
@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
|
|||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 113,
|
||||
version = 114,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
|
@ -1102,6 +1102,16 @@ public abstract class DB extends RoomDatabase {
|
|||
db.execSQL("CREATE INDEX IF NOT EXISTS `index_revision_message` ON `revision` (`message`)");
|
||||
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_revision_message_sequence` ON `revision` (`message`, `sequence`)");
|
||||
}
|
||||
|
||||
})
|
||||
.addMigrations(new Migration(113, 114) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("UPDATE message SET encrypt = 1 WHERE id IN " +
|
||||
"(SELECT DISTINCT message FROM attachment" +
|
||||
" WHERE encryption = " + EntityAttachment.PGP_MESSAGE + ")");
|
||||
}
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue