mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Do not use grpid to find last inserted row in chats table
Instead, use last_insert_rowid() function to find the row. There is no race condition in using last_insert_rowid(), because last_insert_rowid() returns row id last inserted in this connection. As we hold the connection during the whole transaction, it is impossible that some other thread will execute INSERT statement in parallel. This commit is part of the effort to get rid of sql::get_rowid hack and use transactions more for related SQL statements.
This commit is contained in:
@@ -893,6 +893,11 @@ fn open(
|
||||
)?;
|
||||
sql.set_raw_config_int(context, "dbversion", 62)?;
|
||||
}
|
||||
if dbversion < 63 {
|
||||
info!(context, "[migration] v63");
|
||||
sql.execute("UPDATE chats SET grpid='' WHERE type=100", NO_PARAMS)?;
|
||||
sql.set_raw_config_int(context, "dbversion", 63)?;
|
||||
}
|
||||
|
||||
// (2) updates that require high-level objects
|
||||
// (the structure is complete now and all objects are usable)
|
||||
|
||||
Reference in New Issue
Block a user