mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
add an index to significantly speed up get_fresh_msg_cnt()
This commit is contained in:
10
src/sql.rs
10
src/sql.rs
@@ -1315,6 +1315,16 @@ async fn open(
|
||||
}
|
||||
sql.set_raw_config_int(context, "dbversion", 67).await?;
|
||||
}
|
||||
if dbversion < 68 {
|
||||
info!(context, "[migration] v68");
|
||||
// the index is used to speed up get_fresh_msg_cnt(), see comment there for more details
|
||||
sql.execute(
|
||||
"CREATE INDEX IF NOT EXISTS msgs_index7 ON msgs (state, hidden, chat_id);",
|
||||
paramsv![],
|
||||
)
|
||||
.await?;
|
||||
sql.set_raw_config_int(context, "dbversion", 68).await?;
|
||||
}
|
||||
|
||||
// (2) updates that require high-level objects
|
||||
// (the structure is complete now and all objects are usable)
|
||||
|
||||
Reference in New Issue
Block a user