Additional CaldavTask indexes

pull/3491/head
Alex Baker 8 months ago
parent 660b6c8df5
commit 137f437d78

@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 90,
"identityHash": "c376076b2c39c19f28c221313fea1e15",
"identityHash": "967aa71f3344c8d6dd232aeaa63d9be2",
"entities": [
{
"tableName": "notification",
@ -886,6 +886,24 @@
]
},
"indices": [
{
"name": "index_caldav_tasks_cd_task",
"unique": false,
"columnNames": [
"cd_task"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_task` ON `${TABLE_NAME}` (`cd_task`)"
},
{
"name": "index_caldav_tasks_cd_remote_id",
"unique": false,
"columnNames": [
"cd_remote_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_remote_id` ON `${TABLE_NAME}` (`cd_remote_id`)"
},
{
"name": "index_caldav_tasks_cd_calendar_cd_remote_id",
"unique": false,
@ -897,13 +915,14 @@
"createSql": "CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_calendar_cd_remote_id` ON `${TABLE_NAME}` (`cd_calendar`, `cd_remote_id`)"
},
{
"name": "index_caldav_tasks_cd_task",
"name": "index_caldav_tasks_cd_calendar_cd_remote_parent",
"unique": false,
"columnNames": [
"cd_task"
"cd_calendar",
"cd_remote_parent"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_task` ON `${TABLE_NAME}` (`cd_task`)"
"createSql": "CREATE INDEX IF NOT EXISTS `index_caldav_tasks_cd_calendar_cd_remote_parent` ON `${TABLE_NAME}` (`cd_calendar`, `cd_remote_parent`)"
}
],
"foreignKeys": [
@ -1230,7 +1249,7 @@
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'c376076b2c39c19f28c221313fea1e15')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '967aa71f3344c8d6dd232aeaa63d9be2')"
]
}
}

@ -287,12 +287,12 @@ GROUP BY caldav_lists.cdl_uuid
p.cd_task AS parent_id
FROM caldav_tasks AS c
INNER JOIN caldav_tasks AS p
ON p.cd_remote_id = c.cd_remote_parent
AND p.cd_calendar = c.cd_calendar
ON p.cd_calendar = c.cd_calendar
AND p.cd_remote_id = c.cd_remote_parent
AND p.cd_deleted = 0
WHERE c.cd_deleted = 0
AND c.cd_remote_parent IS NOT NULL
WHERE c.cd_remote_parent IS NOT NULL
AND c.cd_remote_parent != ''
AND c.cd_deleted = 0
)
UPDATE tasks
SET parent = IFNULL(
@ -314,13 +314,13 @@ GROUP BY caldav_lists.cdl_uuid
p.cd_task AS parent_id
FROM caldav_tasks AS c
INNER JOIN caldav_tasks AS p
ON p.cd_remote_id = c.cd_remote_parent
AND p.cd_calendar = c.cd_calendar
ON p.cd_calendar = c.cd_calendar
AND p.cd_remote_id = c.cd_remote_parent
AND p.cd_deleted = 0
WHERE c.cd_calendar = :calendar
AND c.cd_deleted = 0
AND c.cd_remote_parent IS NOT NULL
AND c.cd_remote_parent != ''
AND c.cd_deleted = 0
)
UPDATE tasks
SET parent = IFNULL(
@ -330,8 +330,8 @@ GROUP BY caldav_lists.cdl_uuid
WHERE _id IN (
SELECT cd_task
FROM caldav_tasks
WHERE cd_deleted = 0
AND cd_calendar = :calendar
WHERE cd_calendar = :calendar
AND cd_deleted = 0
)
""")
abstract suspend fun updateParents(calendar: String)

@ -24,7 +24,10 @@ import org.tasks.data.entity.Task.Companion.NO_ID
),
],
indices = [
Index(value = ["cd_task"]),
Index(value = ["cd_remote_id"]),
Index(value = ["cd_calendar", "cd_remote_id"]),
Index(value = ["cd_calendar", "cd_remote_parent"]),
]
)
data class CaldavTask(
@ -32,7 +35,7 @@ data class CaldavTask(
@ColumnInfo(name = "cd_id")
@Transient
val id: Long = 0,
@ColumnInfo(name = "cd_task", index = true)
@ColumnInfo(name = "cd_task")
@Transient
val task: Long = NO_ID,
@ColumnInfo(name = "cd_calendar")

Loading…
Cancel
Save