mirror of https://github.com/M66B/FairEmail.git
Keep existing POP3 messages
This commit is contained in:
parent
4e2108f0a2
commit
a80cb2ceee
File diff suppressed because it is too large
Load Diff
|
@ -71,7 +71,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
|
|||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 233,
|
||||
version = 234,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
|
@ -2324,6 +2324,25 @@ public abstract class DB extends RoomDatabase {
|
|||
logMigration(startVersion, endVersion);
|
||||
db.execSQL("ALTER TABLE `account` ADD COLUMN 'conditions' TEXT");
|
||||
}
|
||||
}).addMigrations(new Migration(233, 234) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
logMigration(startVersion, endVersion);
|
||||
db.execSQL("UPDATE account" +
|
||||
" SET max_messages = MAX(max_messages," +
|
||||
" (SELECT COUNT(*) FROM folder" +
|
||||
" JOIN message ON message.folder = folder.id" +
|
||||
" WHERE folder.account = account.id" +
|
||||
" AND folder.type = '" + EntityFolder.INBOX + "'" +
|
||||
" AND NOT message.ui_hide))" +
|
||||
" WHERE pop = " + EntityAccount.TYPE_POP +
|
||||
" AND NOT max_messages IS NULL");
|
||||
}
|
||||
}).addMigrations(new Migration(234, 233) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
logMigration(startVersion, endVersion);
|
||||
}
|
||||
}).addMigrations(new Migration(998, 999) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase db) {
|
||||
|
|
Loading…
Reference in New Issue