diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-10-25 20:54:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 20:54:20 +0100 |
commit | ce4573c5eea904c77773f2c2b8a7b6cd74977f15 (patch) | |
tree | d2fc5c13a8ac1a843ecad7cfd1d4448fbf16f2a4 /atuin-client/src/database.rs | |
parent | 0b22d06ad3586ef5e9486a4768feaa8f6d0ddb80 (diff) |
Fix deleted history count (#1328)
Diffstat (limited to 'atuin-client/src/database.rs')
-rw-r--r-- | atuin-client/src/database.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index a7be9436d..2e4211aaa 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -346,12 +346,13 @@ impl Database for Sqlite { } async fn history_count(&self, include_deleted: bool) -> Result<i64> { - let exclude_deleted: &str = if include_deleted { "" } else { "not" }; - let query = format!( - "select count(1) from history where deleted_at is {} null", - exclude_deleted - ); - let res: (i64,) = sqlx::query_as(&query).fetch_one(&self.pool).await?; + let query = if include_deleted { + "select count(1) from history" + } else { + "select count(1) from history where deleted_at is null" + }; + + let res: (i64,) = sqlx::query_as(query).fetch_one(&self.pool).await?; Ok(res.0) } |