summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-01 16:21:17 +0000
committerErik Johnston <erik@matrix.org>2014-12-01 16:22:07 +0000
commitec2b5d8c284451179c0f7b72c46dda0dd81f6f5f (patch)
tree558ddd1adeb905df498b4fbafba32cd9590a792a /synapse/storage/__init__.py
parentre-add OSX troubleshooting instructions (not sure how they got lost) (diff)
downloadsynapse-ec2b5d8c284451179c0f7b72c46dda0dd81f6f5f.tar.xz
Store full JSON of events in db
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index f15e3dfe62..205d125642 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -155,6 +155,25 @@ class DataStore(RoomMemberStore, RoomStore,
         if hasattr(event, "outlier"):
             outlier = event.outlier
 
+        event_dict = {
+            k: v
+            for k, v in event.get_full_dict().items()
+            if k not in [
+                "redacted",
+                "redacted_because",
+            ]
+        }
+
+        self._simple_insert_txn(
+            txn,
+            table="event_json",
+            values={
+                "event_id": event.event_id,
+                "json": json.dumps(event_dict, separators=(',', ':')),
+            },
+            or_replace=True,
+        )
+
         vals = {
             "topological_ordering": event.depth,
             "event_id": event.event_id,