summary refs log tree commit diff
path: root/synapse/storage/registration.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-01 14:12:33 +0100
committerErik Johnston <erik@matrix.org>2015-04-01 14:12:33 +0100
commit9236136f3a4f0d8119d4a6333f37378f8e259e4a (patch)
treec8e806fc815f9215501e409cf20471529cef4d15 /synapse/storage/registration.py
parentFix unicode database support (diff)
downloadsynapse-9236136f3a4f0d8119d4a6333f37378f8e259e4a.tar.xz
Make work in both Maria and SQLite. Fix tests
Diffstat (limited to 'synapse/storage/registration.py')
-rw-r--r--synapse/storage/registration.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 7258f7b2a5..0c785ec989 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -42,6 +42,7 @@ class RegistrationStore(SQLBaseStore):
         yield self._simple_insert(
             "access_tokens",
             {
+                "id": self.get_next_stream_id(),
                 "user_id": user_id,
                 "token": token
             },
@@ -78,8 +79,11 @@ class RegistrationStore(SQLBaseStore):
 
         # it's possible for this to get a conflict, but only for a single user
         # since tokens are namespaced based on their user ID
-        txn.execute("INSERT INTO access_tokens(user_id, token) " +
-                    "VALUES (?,?)", [user_id, token])
+        txn.execute(
+            "INSERT INTO access_tokens(id, user_id, token)"
+            " VALUES (?,?,?)",
+            (self.get_next_stream_id(), user_id, token,)
+        )
 
     @defer.inlineCallbacks
     def get_user_by_id(self, user_id):