Merge pull request #2093 from k9mail/fix-multipart-data-location

use CHILD_PART_CONTAINS_DATA as data location for multipart
This commit is contained in:
Vincent Breitmoser 2017-01-19 18:10:19 +01:00 committed by GitHub
commit dc38b6d66c
4 changed files with 19 additions and 2 deletions

View file

@ -1438,7 +1438,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
}
private void multipartToContentValues(ContentValues cv, Multipart multipart) {
cv.put("data_location", DataLocation.IN_DATABASE);
cv.put("data_location", DataLocation.CHILD_PART_CONTAINS_DATA);
cv.put("preamble", multipart.getPreamble());
cv.put("epilogue", multipart.getEpilogue());
cv.put("boundary", multipart.getBoundary());

View file

@ -153,7 +153,7 @@ public class LocalStore extends Store implements Serializable {
*/
private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500;
public static final int DB_VERSION = 56;
public static final int DB_VERSION = 57;
public static String getColumnNameForFlag(Flag flag) {

View file

@ -0,0 +1,15 @@
package com.fsck.k9.mailstore.migrations;
import android.database.sqlite.SQLiteDatabase;
class MigrationTo57 {
private static final int IN_DATABASE = 1;
private static final int CHILD_PART_CONTAINS_DATA = 3;
static void fixDataLocationForMultipartParts(SQLiteDatabase db) {
db.execSQL("UPDATE message_parts SET data_location = " + CHILD_PART_CONTAINS_DATA + " " +
"WHERE data_location = " + IN_DATABASE + " AND mime_type LIKE 'multipart/%'");
}
}

View file

@ -66,6 +66,8 @@ public class Migrations {
MigrationTo55.createFtsSearchTable(db, migrationsHelper);
case 55:
MigrationTo56.cleanUpFtsTable(db);
case 56:
MigrationTo57.fixDataLocationForMultipartParts(db);
}
}
}