Handle Kryo version incompatibility

This commit is contained in:
Niels Andriesse 2021-05-21 09:08:16 +10:00
parent e42b884b13
commit 6829895995
2 changed files with 9 additions and 2 deletions

View File

@ -56,9 +56,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV22 = 43; private static final int lokiV22 = 43;
private static final int lokiV23 = 44; private static final int lokiV23 = 44;
private static final int lokiV24 = 45; private static final int lokiV24 = 45;
private static final int lokiV25 = 46;
// Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes // Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
private static final int DATABASE_VERSION = lokiV24; private static final int DATABASE_VERSION = lokiV25;
private static final String DATABASE_NAME = "signal.db"; private static final String DATABASE_NAME = "signal.db";
private final Context context; private final Context context;
@ -291,6 +292,12 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
db.execSQL(LokiAPIDatabase.getCreateSwarmTableCommand()); db.execSQL(LokiAPIDatabase.getCreateSwarmTableCommand());
} }
if (oldVersion < lokiV25) {
String jobTable = SessionJobDatabase.sessionJobTable;
db.execSQL("DROP TABLE " + jobTable);
db.execSQL(SessionJobDatabase.getCreateSessionJobTableCommand());
}
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
db.endTransaction(); db.endTransaction();

View File

@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.loki.utilities.*
class SessionJobDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) { class SessionJobDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) {
companion object { companion object {
private const val sessionJobTable = "session_job_database" const val sessionJobTable = "session_job_database"
const val jobID = "job_id" const val jobID = "job_id"
const val jobType = "job_type" const val jobType = "job_type"
const val failureCount = "failure_count" const val failureCount = "failure_count"