rename encryption PRAGMA key to hexkey

This commit is contained in:
Avinash Sajjanshetty
2025-08-25 01:32:41 +05:30
parent de16c770c3
commit 543025f57a
3 changed files with 6 additions and 7 deletions

View File

@@ -109,7 +109,7 @@ pub fn pragma_for(pragma: &PragmaName) -> Pragma {
FreelistCount => Pragma::new(PragmaFlags::Result0, &["freelist_count"]),
EncryptionKey => Pragma::new(
PragmaFlags::Result0 | PragmaFlags::SchemaReq | PragmaFlags::NoColumns1,
&["key"],
&["hexkey"],
),
}
}

View File

@@ -1221,10 +1221,9 @@ pub enum PragmaName {
IntegrityCheck,
/// `journal_mode` pragma
JournalMode,
/// encryption key for encrypted databases. This is just called `key` because most
/// extensions use this name instead of `encryption_key`.
#[strum(serialize = "key")]
#[cfg_attr(feature = "serde", serde(rename = "key"))]
/// encryption key for encrypted databases, specified as hexadecimal string.
#[strum(serialize = "hexkey")]
#[cfg_attr(feature = "serde", serde(rename = "hexkey"))]
EncryptionKey,
/// Noop as per SQLite docs
LegacyFileFormat,

View File

@@ -16,7 +16,7 @@ fn test_per_page_encryption() -> anyhow::Result<()> {
run_query(
&tmp_db,
&conn,
"PRAGMA key = 'super secret key for encryption';",
"PRAGMA hexkey = 'super secret key for encryption';",
)?;
run_query(
&tmp_db,
@@ -58,7 +58,7 @@ fn test_per_page_encryption() -> anyhow::Result<()> {
run_query(
&existing_db,
&conn,
"PRAGMA key = 'super secret key for encryption';",
"PRAGMA hexkey = 'super secret key for encryption';",
)?;
run_query_on_row(&existing_db, &conn, "SELECT * FROM test", |row: &Row| {
assert_eq!(row.get::<i64>(0).unwrap(), 1);