pub(crate) mod sql {
pub(crate) const INSERT_NEW: &str = r#"INSERT 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 > UTC_TIMESTAMP(6)"#;
pub(crate) const DELETE_FOR: &str = "DELETE FROM arcature_password_resets WHERE subject = ?";
pub(crate) const DELETE_EXPIRED: &str =
"DELETE FROM arcature_password_resets WHERE expires_at <= UTC_TIMESTAMP(6)";
pub(crate) const CREATE_HISTORY: &str = r#"CREATE TABLE IF NOT EXISTS arcature_password_resets_schema_migrations (
version VARCHAR(191) NOT NULL PRIMARY KEY,
applied_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
) ENGINE=InnoDB"#;
pub(crate) const COUNT_APPLIED: &str =
"SELECT COUNT(*) FROM arcature_password_resets_schema_migrations WHERE version = ?";
pub(crate) const RECORD_APPLIED: &str =
"INSERT IGNORE INTO arcature_password_resets_schema_migrations (version) VALUES (?)";
pub(crate) const LOCK: Option<&str> =
Some("SELECT GET_LOCK('arcature_password_resets_migrate', 10)");
pub(crate) const UNLOCK: Option<&str> =
Some("SELECT RELEASE_LOCK('arcature_password_resets_migrate')");
pub(crate) const SCHEMA: &str = include_str!("../migrations/mysql/0001_password_resets.sql");
}