Files
bodyshop/hasura/migrations/1588004408193_run_sql_migration/up.yaml

19 lines
493 B
YAML

- args:
cascade: true
read_only: false
sql: |-
CREATE OR REPLACE FUNCTION public.search_owner(search text)
RETURNS SETOF owners
LANGUAGE sql
STABLE
AS $function$
SELECT *
FROM owners
WHERE
search <% (ownr_fn || ' ' || ownr_ln || ' ' || ownr_co_nm)
ORDER BY
similarity(search, (ownr_fn || ' ' || ownr_ln || ' ' || ownr_co_nm)) DESC
LIMIT 5;
$function$;
type: run_sql