diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-29 19:37:28 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-29 19:37:28 +0100 |
commit | 91e6a152c066d1bcff15a9585d6830feb1a53288 (patch) | |
tree | 9d44948c20b877924ba999e385e8296d943d5706 /src/main/java/de/pixart/messenger/persistance | |
parent | e83be0590524fa72158f2441a87295dff0038b89 (diff) |
add database migrations
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index 1b3a9aaa4..bb4652308 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -55,7 +55,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { private static DatabaseBackend instance = null; public static final String DATABASE_NAME = "history"; - public static final int DATABASE_VERSION = 33; + public static final int DATABASE_VERSION = 34; private static String CREATE_CONTATCS_STATEMENT = "create table " + Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, " @@ -144,6 +144,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { private static String START_TIMES_TABLE = "start_times"; private static String CREATE_START_TIMES_TABLE = "create table " + START_TIMES_TABLE + " (timestamp NUMBER);"; + private static String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")"; private DatabaseBackend(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); @@ -193,6 +194,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Conversation.TABLENAME + "(" + Conversation.UUID + ") ON DELETE CASCADE);"); + db.execSQL(CREATE_MESSAGE_TIME_INDEX); db.execSQL(CREATE_CONTATCS_STATEMENT); db.execSQL(CREATE_DISCOVERY_RESULTS_STATEMENT); db.execSQL(CREATE_SESSIONS_STATEMENT); @@ -387,6 +389,10 @@ public class DatabaseBackend extends SQLiteOpenHelper { String whereClause = SQLiteAxolotlStore.OWN+"=1"; db.update(SQLiteAxolotlStore.IDENTITIES_TABLENAME,createFingerprintStatusContentValues(FingerprintStatus.Trust.VERIFIED,true),whereClause,null); } + if (oldVersion < 34 && newVersion >= 34) { + db.execSQL(CREATE_MESSAGE_TIME_INDEX); + // do nothing else at this point because we have seperated videos, images, audios and other files in different directories + } } private static ContentValues createFingerprintStatusContentValues(FingerprintStatus.Trust trust, boolean active) { |