pub(crate) mod sql {
pub(crate) const INSERT_NEW: &str = r#"INSERT OR IGNORE INTO arcature_password_resets
(id, secret_digest, subject, expires_at, created_at)
VALUES (?, ?, ?, ?, ?)"#;
pub(crate) const FIND_LIVE: &str = r#"SELECT secret_digest, subject
FROM arcature_password_resets
WHERE id = ?
AND expires_at > CAST((julianday('now')-2440587.5)*86400000 AS INTEGER)"#;
pub(crate) const DELETE_FOR: &str = "DELETE FROM arcature_password_resets WHERE subject = ?";
pub(crate) const DELETE_EXPIRED: &str = r#"DELETE FROM arcature_password_resets
WHERE expires_at <= CAST((julianday('now')-2440587.5)*86400000 AS INTEGER)"#;
pub(crate) const CREATE_HISTORY: &str = r#"CREATE TABLE IF NOT EXISTS arcature_password_resets_schema_migrations (
version TEXT PRIMARY KEY,
applied_at INTEGER NOT NULL
DEFAULT (CAST((julianday('now')-2440587.5)*86400000 AS INTEGER))
)"#;
pub(crate) const COUNT_APPLIED: &str =
"SELECT COUNT(*) FROM arcature_password_resets_schema_migrations WHERE version = ?";
pub(crate) const RECORD_APPLIED: &str =
"INSERT OR IGNORE INTO arcature_password_resets_schema_migrations (version) VALUES (?)";
pub(crate) const LOCK: Option<&str> = None;
pub(crate) const UNLOCK: Option<&str> = None;
pub(crate) const SCHEMA: &str = include_str!("../migrations/sqlite/0001_password_resets.sql");
}