summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-12-31 14:35:25 +0000
committerHubert Chathi <hubert@uhoreg.ca>2018-08-12 19:14:31 -0400
commit15d513f16fd272fb3763a42f05a8f296d4e1abf0 (patch)
treebd45a37deb9a61c2fdb2e9d8449ebd04335eafe5 /synapse/storage
parentfirst cut at a UT (diff)
downloadsynapse-15d513f16fd272fb3763a42f05a8f296d4e1abf0.tar.xz
fix idiocies and so make tests pass
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/e2e_room_keys.py5
-rw-r--r--synapse/storage/schema/delta/46/e2e_room_keys.sql2
2 files changed, 4 insertions, 3 deletions
diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py
index 3c720f3b3e..e4d56b7c37 100644
--- a/synapse/storage/e2e_room_keys.py
+++ b/synapse/storage/e2e_room_keys.py
@@ -207,6 +207,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
                 this_version = version
 
             return self._simple_select_one_txn(
+                txn,
                 table="e2e_room_keys_versions",
                 keyvalues={
                     "user_id": user_id,
@@ -243,9 +244,9 @@ class EndToEndRoomKeyStore(SQLBaseStore):
             )
             current_version = txn.fetchone()[0]
             if current_version is None:
-                current_version = 0
+                current_version = '0'
 
-            new_version = current_version + 1
+            new_version = str(int(current_version) + 1)
 
             self._simple_insert_txn(
                 txn,
diff --git a/synapse/storage/schema/delta/46/e2e_room_keys.sql b/synapse/storage/schema/delta/46/e2e_room_keys.sql
index 16499ac34c..4531fd56ee 100644
--- a/synapse/storage/schema/delta/46/e2e_room_keys.sql
+++ b/synapse/storage/schema/delta/46/e2e_room_keys.sql
@@ -35,4 +35,4 @@ CREATE TABLE e2e_room_keys_versions (
     auth_data TEXT NOT NULL
 );
 
-CREATE UNIQUE INDEX e2e_room_keys_versions_user_idx ON e2e_room_keys_versions(user_id);
+CREATE UNIQUE INDEX e2e_room_keys_versions_idx ON e2e_room_keys_versions(user_id, version);