summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-03-24 16:17:39 +0000
committerErik Johnston <erik@matrix.org>2015-03-24 16:17:39 +0000
commit9115421ace4cd6cd1080ab99c997994541aea30b (patch)
tree36a8f7095fcf578b0e8bb7a28481ce51581204df /synapse/storage/__init__.py
parentRemove uses of REPLACE and ON CONFLICT IGNORE to make the SQL more portable. (diff)
downloadsynapse-9115421ace4cd6cd1080ab99c997994541aea30b.tar.xz
Use _simple_upsert
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 4877f45dce..e03d55b00d 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -81,14 +81,16 @@ class DataStore(RoomMemberStore, RoomStore,
         self._next_stream_id = int(hs.get_clock().time_msec()) * 1000
 
     def insert_client_ip(self, user, access_token, device_id, ip, user_agent):
-        return self._simple_insert(
+        return self._simple_upsert(
             "user_ips",
-            {
+            keyvalues={
                 "user": user.to_string(),
                 "access_token": access_token,
-                "device_id": device_id,
                 "ip": ip,
                 "user_agent": user_agent,
+            },
+            values={
+                "device_id": device_id,
                 "last_seen": int(self._clock.time_msec()),
             },
             desc="insert_client_ip",