Inline open_connection into Db::open
The helper was only called once and added no reuse value.
https://claude.ai/code/session_01YXVu67hVnQSAY8wzmfmRHw
diff --git a/quire-ci/src/db.rs b/quire-ci/src/db.rs
index 54fdab3..abc5a4a 100644
--- a/quire-ci/src/db.rs
+++ b/quire-ci/src/db.rs
@@ -25,7 +25,12 @@ pub struct Db {
impl Db {
pub fn open(path: &Path) -> Result<Self, Error> {
tracing::debug!(path = %path.display(), "opening database");
- let mut conn = open_connection(path)?;
+ let mut conn = Connection::open(path)?;
+ conn.execute_batch(
+ "PRAGMA journal_mode = WAL;
+ PRAGMA foreign_keys = ON;
+ PRAGMA busy_timeout = 5000;",
+ )?;
MIGRATIONS.to_latest(&mut conn)?;
Ok(Self {
conn: Arc::new(Mutex::new(conn)),
@@ -37,16 +42,6 @@ impl Db {
}
}
-fn open_connection(path: &Path) -> Result<Connection, rusqlite::Error> {
- let conn = Connection::open(path)?;
- conn.execute_batch(
- "PRAGMA journal_mode = WAL;
- PRAGMA foreign_keys = ON;
- PRAGMA busy_timeout = 5000;",
- )?;
- Ok(conn)
-}
-
#[cfg(test)]
pub fn open_in_memory() -> Result<Db, Error> {
let mut conn = Connection::open_in_memory()?;