about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-05-01T18·00+0200
committerVincent Ambo <github@tazj.in>2018-05-01T22·33+0200
commit02c15f06d6f7864431d22a07bda8a36d8bc30474 (patch)
tree94d2e7b3ba912d61b0243811bcaa868238208969
parent2159c76ca70df8e2aed7a7b9d7bce5b16a2485f0 (diff)
fix(migrations): Fix search index creation in user migration
-rw-r--r--migrations/2018-05-01-141548_add-users/down.sql2
-rw-r--r--migrations/2018-05-01-141548_add-users/up.sql2
2 files changed, 4 insertions, 0 deletions
diff --git a/migrations/2018-05-01-141548_add-users/down.sql b/migrations/2018-05-01-141548_add-users/down.sql
index a29ee47dd641..2f903171d4ba 100644
--- a/migrations/2018-05-01-141548_add-users/down.sql
+++ b/migrations/2018-05-01-141548_add-users/down.sql
@@ -55,6 +55,8 @@ CREATE MATERIALIZED VIEW search_index AS
     JOIN threads t
     ON t.id = p.thread_id;
 
+CREATE INDEX idx_fts_search ON search_index USING gin(document);
+
 -- and drop the users table and columns:
 ALTER TABLE posts DROP COLUMN author;
 ALTER TABLE threads DROP COLUMN author;
diff --git a/migrations/2018-05-01-141548_add-users/up.sql b/migrations/2018-05-01-141548_add-users/up.sql
index bb358f47b537..222afc485afe 100644
--- a/migrations/2018-05-01-141548_add-users/up.sql
+++ b/migrations/2018-05-01-141548_add-users/up.sql
@@ -68,6 +68,8 @@ CREATE MATERIALIZED VIEW search_index AS
     JOIN users ta ON ta.id = t.author
     JOIN users pa ON pa.id = p.author;
 
+CREATE INDEX idx_fts_search ON search_index USING gin(document);
+
 -- And drop the old fields:
 ALTER TABLE posts DROP COLUMN author_name;
 ALTER TABLE posts DROP COLUMN author_email;