Add active_and_visible index on tasks

gtask_related_email
Alex Baker 5 years ago
parent f027836c0c
commit 3730500d25

File diff suppressed because it is too large Load Diff

@ -58,7 +58,7 @@ import org.tasks.notifications.NotificationDao;
CaldavAccount.class, CaldavAccount.class,
GoogleTaskAccount.class GoogleTaskAccount.class
}, },
version = 67) version = 68)
public abstract class Database extends RoomDatabase { public abstract class Database extends RoomDatabase {
public static final String NAME = "database"; public static final String NAME = "database";

@ -36,12 +36,14 @@ import org.tasks.data.Tag;
import org.tasks.time.DateTime; import org.tasks.time.DateTime;
import timber.log.Timber; import timber.log.Timber;
/** @Entity(
* Data Model which represents a task users need to accomplish. tableName = "tasks",
* indices = {
* @author Tim Su <tim@todoroo.com> @Index(name = "t_rid", value = "remoteId", unique = true),
*/ @Index(
@Entity(tableName = "tasks", indices = @Index(name = "t_rid", value = "remoteId", unique = true)) name = "active_and_visible",
value = {"completed", "deleted", "hideUntil"})
})
public class Task implements Parcelable { public class Task implements Parcelable {
// --- table and uri // --- table and uri

@ -338,6 +338,15 @@ public class Migrations {
} }
}; };
private static final Migration MIGRATION_67_68 =
new Migration(67, 68) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL(
"CREATE INDEX `active_and_visible` ON `tasks` (`completed`, `deleted`, `hideUntil`)");
}
};
public static final Migration[] MIGRATIONS = public static final Migration[] MIGRATIONS =
new Migration[] { new Migration[] {
MIGRATION_35_36, MIGRATION_35_36,
@ -362,7 +371,8 @@ public class Migrations {
MIGRATION_63_64, MIGRATION_63_64,
MIGRATION_64_65, MIGRATION_64_65,
MIGRATION_65_66, MIGRATION_65_66,
MIGRATION_66_67 MIGRATION_66_67,
MIGRATION_67_68
}; };
private static Migration NOOP(int from, int to) { private static Migration NOOP(int from, int to) {

Loading…
Cancel
Save