diff options
author | Erik Johnston <erik@matrix.org> | 2015-10-14 09:52:40 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-10-14 09:52:40 +0100 |
commit | 99c7fbfef7729e6f3cceb9cea64f21d5a2c5b41f (patch) | |
tree | c2e88ba2accfb58ab9019a494248ef0d41facb20 /synapse/storage/room.py | |
parent | More TODO markers (diff) | |
download | synapse-99c7fbfef7729e6f3cceb9cea64f21d5a2c5b41f.tar.xz |
Fix to work with SQLite
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/room.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py index e4e830944a..0527cee05d 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -19,6 +19,7 @@ from synapse.api.errors import StoreError from ._base import SQLBaseStore from synapse.util.caches.descriptors import cachedInlineCallbacks +from .engines import PostgresEngine import collections import logging @@ -202,10 +203,16 @@ class RoomStore(SQLBaseStore): ) def _store_event_search_txn(self, txn, event, key, value): - sql = ( - "INSERT INTO event_search (event_id, room_id, key, vector)" - " VALUES (?,?,?,to_tsvector('english', ?))" - ) + if isinstance(self.database_engine, PostgresEngine): + sql = ( + "INSERT INTO event_search (event_id, room_id, key, vector)" + " VALUES (?,?,?,to_tsvector('english', ?))" + ) + else: + sql = ( + "INSERT INTO event_search (event_id, room_id, key, value)" + " VALUES (?,?,?,?)" + ) txn.execute(sql, (event.event_id, event.room_id, key, value,)) |