summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-18 10:11:43 +0000
committerErik Johnston <erik@matrix.org>2016-02-18 10:11:43 +0000
commit112283e23005bdaa17b6184cb55fd786facff47d (patch)
tree6028e91034155cce73c2ab36e544cd7267c305b0 /synapse/storage
parentRemove status_msg when going offline. Don't offline -> online if you send a m... (diff)
downloadsynapse-112283e23005bdaa17b6184cb55fd786facff47d.tar.xz
Prefix TS fields with _ts
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/__init__.py4
-rw-r--r--synapse/storage/presence.py23
-rw-r--r--synapse/storage/schema/delta/30/presence_stream.sql6
3 files changed, 17 insertions, 16 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 8c3cf9e801..fcb968e8f4 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -203,8 +203,8 @@ class DataStore(RoomMemberStore, RoomStore,
         """
 
         sql = (
-            "SELECT user_id, state, last_active, last_federation_update,"
-            " last_user_sync, status_msg, currently_active FROM presence_stream"
+            "SELECT user_id, state, last_active_ts, last_federation_update_ts,"
+            " last_user_sync_ts, status_msg, currently_active FROM presence_stream"
             " WHERE state != ?"
         )
         sql = self.database_engine.convert_param_style(sql)
diff --git a/synapse/storage/presence.py b/synapse/storage/presence.py
index b133979102..70ece56548 100644
--- a/synapse/storage/presence.py
+++ b/synapse/storage/presence.py
@@ -22,8 +22,9 @@ from twisted.internet import defer
 
 
 class UserPresenceState(namedtuple("UserPresenceState",
-                        ("user_id", "state", "last_active", "last_federation_update",
-                            "last_user_sync", "status_msg", "currently_active"))):
+                        ("user_id", "state", "last_active_ts",
+                            "last_federation_update_ts", "last_user_sync_ts",
+                            "status_msg", "currently_active"))):
     """Represents the current presence state of the user.
 
     user_id (str)
@@ -46,9 +47,9 @@ class UserPresenceState(namedtuple("UserPresenceState",
         return cls(
             user_id=user_id,
             state=PresenceState.OFFLINE,
-            last_active=0,
-            last_federation_update=0,
-            last_user_sync=0,
+            last_active_ts=0,
+            last_federation_update_ts=0,
+            last_user_sync_ts=0,
             status_msg=None,
             currently_active=False,
         )
@@ -82,9 +83,9 @@ class PresenceStore(SQLBaseStore):
                     "stream_id": stream_id,
                     "user_id": state.user_id,
                     "state": state.state,
-                    "last_active": state.last_active,
-                    "last_federation_update": state.last_federation_update,
-                    "last_user_sync": state.last_user_sync,
+                    "last_active_ts": state.last_active_ts,
+                    "last_federation_update_ts": state.last_federation_update_ts,
+                    "last_user_sync_ts": state.last_user_sync_ts,
                     "status_msg": state.status_msg,
                     "currently_active": state.currently_active,
                 }
@@ -121,9 +122,9 @@ class PresenceStore(SQLBaseStore):
             retcols=(
                 "user_id",
                 "state",
-                "last_active",
-                "last_federation_update",
-                "last_user_sync",
+                "last_active_ts",
+                "last_federation_update_ts",
+                "last_user_sync_ts",
                 "status_msg",
                 "currently_active",
             ),
diff --git a/synapse/storage/schema/delta/30/presence_stream.sql b/synapse/storage/schema/delta/30/presence_stream.sql
index 14f5e3d30a..606bbb037d 100644
--- a/synapse/storage/schema/delta/30/presence_stream.sql
+++ b/synapse/storage/schema/delta/30/presence_stream.sql
@@ -18,9 +18,9 @@
      stream_id BIGINT,
      user_id TEXT,
      state TEXT,
-     last_active BIGINT,
-     last_federation_update BIGINT,
-     last_user_sync BIGINT,
+     last_active_ts BIGINT,
+     last_federation_update_ts BIGINT,
+     last_user_sync_ts BIGINT,
      status_msg TEXT,
      currently_active BOOLEAN
  );