Removed auttachment type index

pull/182/head
M66B 5 years ago
parent 35b983d5f1
commit 847a889515

File diff suppressed because it is too large Load Diff

@ -60,7 +60,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 165, version = 166,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.class, EntityAccount.class,
@ -1634,7 +1634,12 @@ public abstract class DB extends RoomDatabase {
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion); Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("CREATE INDEX IF NOT EXISTS `index_attachment_message_type` ON `attachment` (`message`, `type`)"); db.execSQL("CREATE INDEX IF NOT EXISTS `index_attachment_message_type` ON `attachment` (`message`, `type`)");
createTriggers(db); }
})
.addMigrations(new Migration(165, 166) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
db.execSQL("DROP INDEX `index_attachment_message_type`");
} }
}); });
} }

@ -310,8 +310,8 @@ public interface DaoMessage {
" OR (:recipients AND `bcc` LIKE :find COLLATE NOCASE)" + // no index " OR (:recipients AND `bcc` LIKE :find COLLATE NOCASE)" + // no index
" OR (:subject AND `subject` LIKE :find COLLATE NOCASE)" + // unsuitable index " OR (:subject AND `subject` LIKE :find COLLATE NOCASE)" + // unsuitable index
" OR (:keywords AND `keywords` LIKE :find COLLATE NOCASE)" + // no index " OR (:keywords AND `keywords` LIKE :find COLLATE NOCASE)" + // no index
" OR (:message AND `preview` LIKE :find COLLATE NOCASE)" + " OR (:message AND `preview` LIKE :find COLLATE NOCASE)" + // no index
" OR (:attachments AND attachment.name LIKE :find COLLATE NOCASE)" + " OR (:attachments AND attachment.name LIKE :find COLLATE NOCASE)" + // no index
" OR (:attachments AND attachment.type LIKE :find COLLATE NOCASE)) AS matched" + // no index " OR (:attachments AND attachment.type LIKE :find COLLATE NOCASE)) AS matched" + // no index
" FROM message" + " FROM message" +
" LEFT JOIN attachment ON attachment.message = message.id" + " LEFT JOIN attachment ON attachment.message = message.id" +

@ -50,7 +50,6 @@ import static androidx.room.ForeignKey.CASCADE;
indices = { indices = {
@Index(value = {"message"}), @Index(value = {"message"}),
@Index(value = {"message", "sequence"}, unique = true), @Index(value = {"message", "sequence"}, unique = true),
@Index(value = {"message", "type"}),
@Index(value = {"message", "cid"}) @Index(value = {"message", "cid"})
} }
) )

Loading…
Cancel
Save