Add migration to rewrite 'last_updated' column

This commit is contained in:
cketti 2021-08-14 21:28:39 +02:00
parent 21102b50dc
commit eb1b310968
3 changed files with 14 additions and 1 deletions

View file

@ -12,7 +12,7 @@ import timber.log.Timber;
class StoreSchemaDefinition implements SchemaDefinition {
static final int DB_VERSION = 79;
static final int DB_VERSION = 80;
private final MigrationsHelper migrationsHelper;

View file

@ -0,0 +1,12 @@
package com.fsck.k9.storage.migrations
import android.database.sqlite.SQLiteDatabase
/**
* Rewrite 'last_update' column to NULL when the value is 0
*/
internal class MigrationTo80(private val db: SQLiteDatabase) {
fun rewriteLastUpdatedColumn() {
db.execSQL("UPDATE folders SET last_updated = NULL WHERE last_updated = 0")
}
}

View file

@ -25,5 +25,6 @@ object Migrations {
// 77: No longer necessary
if (oldVersion < 78) MigrationTo78(db).removeServerIdFromLocalFolders()
if (oldVersion < 79) MigrationTo79(db).updateDeleteMessageTrigger()
if (oldVersion < 80) MigrationTo80(db).rewriteLastUpdatedColumn()
}
}