Revamped owner search to show better entries. IO-437
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[]
|
||||
21
hasura/migrations/1608179336471_run_sql_migration/up.yaml
Normal file
21
hasura/migrations/1608179336471_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
- args:
|
||||
cascade: true
|
||||
read_only: false
|
||||
sql: "CREATE OR REPLACE FUNCTION public.search_owners (search text)\n\tRETURNS
|
||||
SETOF owners\n\tLANGUAGE plpgsql\n\tSTABLE\n\tAS $FUNCTION$\nBEGIN\n\tIF search
|
||||
= '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\towners;\n\tELSE\n\t\tRETURN
|
||||
query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\towners\n\t\tWHERE\n\t\t\townr_ln
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR ownr_fn ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
ownr_fn ILIKE '%' || search || '%'\n\t\t\tOR ownr_co_nm ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR ownr_ph1 ILIKE '%' || search || '%'\n\t\t\tOR ownr_addr1 ILIKE
|
||||
'%' || search || '%'\n\t\tORDER BY\n\t\t\townr_ln ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
NULL,\n\t\t\townr_fn ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_co_nm
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_fn ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR NULL,\n\t\t\townr_ph1 ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR NULL;\n\tEND IF;\nEND
|
||||
$FUNCTION$;"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: search_owners
|
||||
schema: public
|
||||
type: track_function
|
||||
Reference in New Issue
Block a user