Apply FTS migration 20260207200000_add_fts_search to live Postgres — searchVector columns not GENERATED, no GIN indexes #70
Labels
No labels
blocked:gate-fetch
blocked:gate-implement
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:needs-local-checkout
blocked:no-changes
bug
feature-request
in-progress
needs-decompose
needs-triage
ops-task
quickfix
security/high
security/low
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/nodedesk#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Live Postgres (
pg-nodedesk) onunstablehas the foursearchVectortsvector columns (Client,System,Note,WorkLog) but they are NOT declared asGENERATED ALWAYS AS (...) STOREDand there are NO GIN indexes. The Prisma migrationprisma/migrations/20260207200000_add_fts_search/migration.sqlexists and is correct, but it was never applied to this DB because the database was bootstrapped viaprisma db push(no_prisma_migrationstable) instead ofprisma migrate deploy.Impact
FTS queries (
Note.searchVector @@ websearch_to_tsquery(...)) currently cannot return results because:searchVectorcolumns are NULL/empty — never auto-populated.All four tables are empty in dev (
pg_stat_user_tables.n_live_tup = 0) so the bug is not yet user-visible, but any seed/import of data would silently produce rows with NULL searchVectors and zero FTS capability.Reproduction
Returns 4 rows with
data_type=tsvector, is_generated=NEVER.Returns 0 rows.
Will be 0 (no rows) regardless of how many rows exist — but in dev the count is 0 because there are no rows at all.
Proposed fix
Apply the migration's SQL statements manually to the live DB:
This is the EXACT content of
prisma/migrations/20260207200000_add_fts_search/migration.sql(UP section). Because the DB is dev-only and tables are empty, dropping and recreating the columns is safe.Acceptance criteria
searchVectorcolumns reportis_generated=ALWAYSininformation_schema.columns.pg_indexes.prisma db pushagainst the live DB still passes (prisma validatealready passes; this isprisma db push --accept-data-loss).SELECT count(*) FROM "Note" WHERE "searchVector" @@ websearch_to_tsquery('english', 'hello');returns rows containing "hello" in title or body._prisma_migrationstable is backfilled with this migration marked applied, so futureprisma migrate deploydoes not re-run it.Related
nd-007-fts-searchbranch's content has been absorbed into main via other PRs)prisma/migrations/20260207200000_add_fts_search/migration.sql(the migration that should be re-applied)Labels
bug, ops-task