pub(crate) mod sql {
pub(crate) const INSERT_NEW: &str =
"INSERT OR IGNORE INTO arcature_sessions (id, data, expires_at) VALUES (?, ?, ?)";
pub(crate) const UPSERT: &str = r#"INSERT INTO arcature_sessions (id, data, expires_at)
VALUES (?, ?, ?)
ON CONFLICT (id) DO UPDATE
SET data = excluded.data, expires_at = excluded.expires_at"#;
pub(crate) const LOAD: &str = r#"SELECT data, expires_at
FROM arcature_sessions
WHERE id = ?
AND expires_at > CAST((julianday('now')-2440587.5)*86400000 AS INTEGER)"#;
pub(crate) const DELETE: &str = "DELETE FROM arcature_sessions WHERE id = ?";
pub(crate) const DELETE_EXPIRED: &str = r#"DELETE FROM arcature_sessions
WHERE expires_at <= CAST((julianday('now')-2440587.5)*86400000 AS INTEGER)"#;
pub(crate) const CREATE_HISTORY: &str = r#"CREATE TABLE IF NOT EXISTS arcature_sessions_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_sessions_schema_migrations WHERE version = ?";
pub(crate) const RECORD_APPLIED: &str =
"INSERT OR IGNORE INTO arcature_sessions_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_sessions.sql");
}