From 59e2d636f8c42c7e4a4f74ed5f95e37de3314119 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 17 Dec 2024 14:22:32 +0100 Subject: [PATCH] Store metadata in explicit columns --- components/remote_settings/src/storage.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/components/remote_settings/src/storage.rs b/components/remote_settings/src/storage.rs index da35b6b7bd..3f79cbebc8 100644 --- a/components/remote_settings/src/storage.rs +++ b/components/remote_settings/src/storage.rs @@ -51,7 +51,9 @@ impl Storage { CREATE TABLE IF NOT EXISTS collection_metadata ( collection_url TEXT PRIMARY KEY, last_modified INTEGER, - metadata BLOB NOT NULL, + signature TEXT, + public_key TEXT, + x5u TEXT, fetched BOOLEAN ); ", @@ -155,7 +157,18 @@ impl Storage { tx.execute("DELETE FROM records", [])?; tx.execute("DELETE FROM collection_metadata", [])?; - tx.execute("INSERT OR REPLACE INTO collection_metadata (collection_url, last_modified, metadata, fetched) VALUES (?, ?, ?, true)", (collection_url, timestamp, serde_json::to_vec(&metadata)?))?; + tx.execute( + "INSERT OR REPLACE INTO collection_metadata \ + (collection_url, last_modified, signature, public_key, x5u, fetched) \ + VALUES (?, ?, ?, ?, ?, true)", + ( + collection_url, + timestamp, + metadata.signature.signature, + metadata.signature.public_key, + metadata.signature.x5u, + ), + )?; { let mut stmt =