summary refs log tree commit diff
path: root/synapse/storage/schema/delta
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-05-31 15:23:49 +0100
committerErik Johnston <erik@matrix.org>2017-05-31 15:23:49 +0100
commit5d79d728f5f38463171f0d063713905f8cb9faec (patch)
tree67741a257e1eb8706dc41dd48f6c5bfdd7a0f6e3 /synapse/storage/schema/delta
parentPull max id from correct table (diff)
downloadsynapse-5d79d728f5f38463171f0d063713905f8cb9faec.tar.xz
Split out directory and search tables
Diffstat (limited to 'synapse/storage/schema/delta')
-rw-r--r--synapse/storage/schema/delta/42/user_dir.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/synapse/storage/schema/delta/42/user_dir.py b/synapse/storage/schema/delta/42/user_dir.py
index 95a7a79fd3..7e32662928 100644
--- a/synapse/storage/schema/delta/42/user_dir.py
+++ b/synapse/storage/schema/delta/42/user_dir.py
@@ -28,30 +28,33 @@ CREATE TABLE user_directory_stream_pos (
 );
 
 INSERT INTO user_directory_stream_pos (stream_id) VALUES (null);
-"""
-
 
-POSTGRES_TABLE = """
 CREATE TABLE user_directory (
     user_id TEXT NOT NULL,
     room_id TEXT NOT NULL,  -- A room_id that we know is public
     display_name TEXT,
-    avatar_url TEXT,
-    vector tsvector
+    avatar_url TEXT
 );
 
-CREATE INDEX user_directory_fts_idx ON user_directory USING gin(vector);
 CREATE INDEX user_directory_room_idx ON user_directory(room_id);
 CREATE INDEX user_directory_user_idx ON user_directory(user_id);
 """
 
 
-SQLITE_TABLE = """
-CREATE VIRTUAL TABLE user_directory
-    USING fts4 ( user_id, room_id, display_name, avatar_url, value );
+POSTGRES_TABLE = """
+CREATE TABLE user_directory_search (
+    user_id TEXT NOT NULL,
+    vector tsvector
+);
 
-CREATE INDEX user_directory_room_idx ON user_directory(room_id);
-CREATE INDEX user_directory_user_idx ON user_directory(user_id);
+CREATE INDEX user_directory_search_fts_idx ON user_directory_search USING gin(vector);
+CREATE INDEX user_directory_search_user_idx ON user_directory_search(user_id);
+"""
+
+
+SQLITE_TABLE = """
+CREATE VIRTUAL TABLE user_directory_search
+    USING fts4 ( user_id, value );
 """