I have a full-text search query in PostgreSQL that looks like this:
to_tsvector('english', coalesce("products"."name"::text, '')) || to_tsvector('english', coalesce("products"."uid"::text, '')) || to_tsvector('english', coalesce("products"."serial"::text, ''));
But creating a migration like this does not work for some reason:
create_trigger(compatibility: 1).on(:products).before(:insert, :update) do
"new.tsv_body := to_tsvector('english', coalesce("products"."name"::text, '')) || to_tsvector('english', coalesce("products"."uid"::text, '')) || to_tsvector('english', coalesce("products"."serial"::text, ''));"
end
Any advice?