summary refs log tree commit diff
path: root/synapse/storage/schema
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-10-17 11:40:35 +0100
committerMark Haines <mark.haines@matrix.org>2014-10-17 11:40:35 +0100
commitc8f996e29ffd7055bc6521ea610fc12ff50502e5 (patch)
treeff3dabd4839af6902336ec4314270d1f55051eb6 /synapse/storage/schema
parentInclude hashes of previous pdus when referencing them (diff)
downloadsynapse-c8f996e29ffd7055bc6521ea610fc12ff50502e5.tar.xz
Hash the same content covered by the signature when referencing previous PDUs rather than reusing the PDU content hashes
Diffstat (limited to 'synapse/storage/schema')
-rw-r--r--synapse/storage/schema/signatures.sql18
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/storage/schema/signatures.sql b/synapse/storage/schema/signatures.sql
index a72c4dc35f..1c45a51bec 100644
--- a/synapse/storage/schema/signatures.sql
+++ b/synapse/storage/schema/signatures.sql
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 
-CREATE TABLE IF NOT EXISTS pdu_hashes (
+CREATE TABLE IF NOT EXISTS pdu_content_hashes (
   pdu_id TEXT,
   origin TEXT,
   algorithm TEXT,
@@ -21,7 +21,21 @@ CREATE TABLE IF NOT EXISTS pdu_hashes (
   CONSTRAINT uniqueness UNIQUE (pdu_id, origin, algorithm)
 );
 
-CREATE INDEX IF NOT EXISTS pdu_hashes_id ON pdu_hashes (pdu_id, origin);
+CREATE INDEX IF NOT EXISTS pdu_content_hashes_id ON pdu_content_hashes (
+    pdu_id, origin
+);
+
+CREATE TABLE IF NOT EXISTS pdu_reference_hashes (
+  pdu_id TEXT,
+  origin TEXT,
+  algorithm TEXT,
+  hash BLOB,
+  CONSTRAINT uniqueness UNIQUE (pdu_id, origin, algorithm)
+);
+
+CREATE INDEX IF NOT EXISTS pdu_reference_hashes_id ON pdu_reference_hashes (
+    pdu_id, origin
+);
 
 CREATE TABLE IF NOT EXISTS pdu_origin_signatures (
   pdu_id TEXT,