Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP INDEX idx_candidates_id_nocase
1 change: 1 addition & 0 deletions migrations/20251129150553_compare_case_insensitive.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX idx_candidates_id_nocase ON candidates(id COLLATE NOCASE);
6 changes: 3 additions & 3 deletions src/database/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub async fn get(id: &str, executor: impl SqliteExecutor<'_>) -> Result<Option<C
r#"
SELECT id, verification_time as "verification_time: NaiveDateTime"
FROM candidates
WHERE id = $1
WHERE id = $1 COLLATE NOCASE
"#,
id
)
Expand All @@ -42,7 +42,7 @@ pub async fn verify(id: &str, executor: impl SqliteExecutor<'_>) -> Result<()> {
r#"
UPDATE candidates
SET verification_time = $2
WHERE id = $1
WHERE id = $1 COLLATE NOCASE
"#,
id,
now
Expand All @@ -55,7 +55,7 @@ pub async fn verify(id: &str, executor: impl SqliteExecutor<'_>) -> Result<()> {

#[tracing::instrument(skip(executor))]
pub async fn delete(id: &str, executor: impl SqliteExecutor<'_>) -> Result<()> {
sqlx::query!("DELETE FROM candidates WHERE id = $1", id)
sqlx::query!("DELETE FROM candidates WHERE id = $1 COLLATE NOCASE", id)
.execute(executor)
.await?;

Expand Down