T14/Bug #3 HIGH: Postgres search_vector trigger + backfill

The tasks/notes/projects/habits/domains tables all have a tsvector
search_vector column and a GIN index, but nothing was populating it.
GET /api/search returned zero results for every query.

This migration adds a BEFORE INSERT OR UPDATE trigger on each of the
five searchable tables. The trigger function uses to_tsvector with
the appropriate title + description/content columns and is named
project_e_search_vector_<table>_update. Drops any pre-existing trigger
of the same name so re-running the migration is safe.

Backfills 64 existing rows.

Parent: t_e1cbd87d
This commit is contained in:
Hermes
2026-08-01 04:15:14 +00:00
parent d4c02a3de2
commit 2e451093b6
2 changed files with 100 additions and 0 deletions
+7
View File
@@ -36,6 +36,13 @@
"when": 1785455000000,
"tag": "0004_add_owner_id_to_domains",
"breakpoints": true
},
{
"idx": 5,
"version": "7",
"when": 1785557679802,
"tag": "0005_search_vector_trigger",
"breakpoints": true
}
]
}