diff --git a/tables.sql b/tables.sql index 00226b8..f276483 100644 --- a/tables.sql +++ b/tables.sql @@ -29,9 +29,16 @@ CREATE TABLE instances ( software VARCHAR(50) ); -ALTER TABLE activities ADD COLUMN normalized_idx tsvector; -UPDATE activities SET normalized_idx = to_tsvector('english', normalized); -CREATE INDEX ON activities USING gin(normalized_idx); +-- ALTER TABLE activities ADD COLUMN normalized_tsvector tsvector; +-- UPDATE activities SET normalized_tsvector = to_tsvector('english', normalized); + +ALTER TABLE activities + ADD normalized_tsvector tsvector + GENERATED ALWAYS AS (to_tsvector('english', normalized)) STORED; + + + +CREATE INDEX normalized_idx ON activities USING gin(normalized_tsvector); CREATE INDEX actors_id_idx ON actors (id); CREATE INDEX activities_id_idx ON activities (id);