Faster database access

This commit is contained in:
M66B
2018-08-07 08:00:17 +00:00
parent 048660d24f
commit 37c226c74d
5 changed files with 49 additions and 40 deletions

View File

@@ -41,7 +41,7 @@ import android.util.Log;
EntityAttachment.class,
EntityOperation.class
},
version = 4,
version = 5,
exportSchema = true
)
@@ -78,6 +78,7 @@ public abstract class DB extends RoomDatabase {
.addMigrations(MIGRATION_1_2)
.addMigrations(MIGRATION_2_3)
.addMigrations(MIGRATION_3_4)
.addMigrations(MIGRATION_4_5)
.build();
}
@@ -109,7 +110,15 @@ public abstract class DB extends RoomDatabase {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("CREATE INDEX `index_message_ui_seen` ON `message` (`ui_seen`)");
db.execSQL("CREATE INDEX `index_message_ui_seen` ON `message` (`ui_seen`)");
}
};
private static final Migration MIGRATION_4_5 = new Migration(4, 5) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("CREATE INDEX `index_message_ui_hide` ON `message` (`ui_hide`)");
}
};