Added suffix to raw message files

This commit is contained in:
M66B 2019-12-13 09:09:45 +01:00
parent f7ade59779
commit d0f4c89233
3 changed files with 2014 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 121,
version = 122,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1176,6 +1176,18 @@ public abstract class DB extends RoomDatabase {
db.execSQL("UPDATE `account` SET ondemand = 0");
}
})
.addMigrations(new Migration(121, 122) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("UPDATE `message` SET raw = NULL");
File[] raws = new File(context.getFilesDir(), "raw").listFiles();
if (raws != null)
for (File file : raws)
file.delete();
}
})
.build();
}

View File

@ -245,7 +245,7 @@ public class EntityMessage implements Serializable {
File dir = new File(context.getFilesDir(), "raw");
if (!dir.exists())
dir.mkdir();
return new File(dir, Long.toString(id));
return new File(dir, id + ".eml");
}
static void snooze(Context context, long id, Long wakeup) {