fix(migrations): Fix search index creation in user migration

This commit is contained in:
Vincent Ambo 2018-05-01 20:00:32 +02:00 committed by Vincent Ambo
parent 2159c76ca7
commit 02c15f06d6
2 changed files with 4 additions and 0 deletions

View file

@ -55,6 +55,8 @@ CREATE MATERIALIZED VIEW search_index AS
JOIN threads t JOIN threads t
ON t.id = p.thread_id; ON t.id = p.thread_id;
CREATE INDEX idx_fts_search ON search_index USING gin(document);
-- and drop the users table and columns: -- and drop the users table and columns:
ALTER TABLE posts DROP COLUMN author; ALTER TABLE posts DROP COLUMN author;
ALTER TABLE threads DROP COLUMN author; ALTER TABLE threads DROP COLUMN author;

View file

@ -68,6 +68,8 @@ CREATE MATERIALIZED VIEW search_index AS
JOIN users ta ON ta.id = t.author JOIN users ta ON ta.id = t.author
JOIN users pa ON pa.id = p.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: -- And drop the old fields:
ALTER TABLE posts DROP COLUMN author_name; ALTER TABLE posts DROP COLUMN author_name;
ALTER TABLE posts DROP COLUMN author_email; ALTER TABLE posts DROP COLUMN author_email;