Schema changes for owner searching to include ownr_co_nm. Requires index rebuild BOD-44
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
18
hasura/migrations/1588004408193_run_sql_migration/up.yaml
Normal file
18
hasura/migrations/1588004408193_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
- 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
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: true
|
||||||
|
read_only: false
|
||||||
|
sql: drop index idx_owner_name;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
- args:
|
||||||
|
cascade: true
|
||||||
|
read_only: false
|
||||||
|
sql: |-
|
||||||
|
CREATE INDEX idx_owner_name ON owners USING GIN ((ownr_fn || ' ' || ownr_ln || ' ' || ownr_co_nm)
|
||||||
|
gin_trgm_ops);
|
||||||
|
type: run_sql
|
||||||
Reference in New Issue
Block a user