mirror of
https://github.com/block/buzz.git
synced 2026-12-01 13:42:45 +00:00
feat(relay): import owner section workspace
Co-authored-by: Larry <loganj+larry@squareup.com> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
20
migrations/0033_section_workspace_projection_fts.sql
Normal file
20
migrations/0033_section_workspace_projection_fts.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Kinds 9050 and 30623 carry owner-private section workspace migration state. Keep it
|
||||
-- out of full-text search at the storage boundary while preserving the expression
|
||||
-- installed by fresh or brownfield databases.
|
||||
DO $$
|
||||
DECLARE existing_expression TEXT;
|
||||
BEGIN
|
||||
SELECT pg_get_expr(d.adbin, d.adrelid) INTO existing_expression
|
||||
FROM pg_attrdef d JOIN pg_attribute a
|
||||
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
|
||||
WHERE d.adrelid = 'events'::regclass AND a.attname = 'search_tsv';
|
||||
IF existing_expression IS NULL THEN
|
||||
RAISE EXCEPTION 'events.search_tsv generated expression not found';
|
||||
END IF;
|
||||
ALTER TABLE events DROP COLUMN search_tsv;
|
||||
EXECUTE format(
|
||||
'ALTER TABLE events ADD COLUMN search_tsv TSVECTOR GENERATED ALWAYS AS (CASE WHEN kind IN (9050, 30623) THEN NULL::tsvector ELSE (%s) END) STORED',
|
||||
existing_expression
|
||||
);
|
||||
CREATE INDEX idx_events_search_tsv ON events USING GIN (search_tsv);
|
||||
END $$;
|
||||
Reference in New Issue
Block a user