mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-26 23:52:05 +00:00
fix: make sqlite migrations atomic
This commit is contained in:
@@ -174,9 +174,10 @@ fn migrate(conn: &Connection) -> rusqlite::Result<()> {
|
|||||||
if version >= target {
|
if version >= target {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
conn.execute_batch(statement)?;
|
let tx = conn.unchecked_transaction()?;
|
||||||
// `PRAGMA` does not take bind parameters; the value is our own index.
|
tx.execute_batch(statement)?;
|
||||||
conn.execute_batch(&format!("PRAGMA user_version = {target}"))?;
|
tx.execute_batch(&format!("PRAGMA user_version = {target}"))?;
|
||||||
|
tx.commit()?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user