Revamped owner search to show better entries. IO-437
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: "CREATE OR REPLACE FUNCTION public.search_owners(search text)\n RETURNS SETOF
|
||||
owners\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n if search = ''
|
||||
then\n return query select * from owners ;\n else \n return query SELECT\n
|
||||
\ *\nFROM\n owners\nWHERE\n search <% (ownr_fn) OR\n search <% (ownr_ln)
|
||||
OR\n search <% (ownr_co_nm) OR\n search <% (ownr_ph1) OR\n search <% (ownr_addr1);\n
|
||||
\ end if;\n\n\tEND\n$function$;"
|
||||
type: run_sql
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: DROP FUNCTION "public"."search_owners"("pg_catalog"."text");
|
||||
type: run_sql
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
17
hasura/migrations/1608179312131_run_sql_migration/up.yaml
Normal file
17
hasura/migrations/1608179312131_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
- 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
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
18
hasura/migrations/1608179815354_run_sql_migration/up.yaml
Normal file
18
hasura/migrations/1608179815354_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
- 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 (ownr_fn || '
|
||||
' || ownr_ln)\n\t\tILIKE '%' || search || '%'\n\t\t\tOR ownr_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\t(ownr_fn || ' ' || ownr_ln)\n\t\t\tILIKE '%' ||
|
||||
search || '%'\n\t\t\tOR NULL,\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\n$FUNCTION$;"
|
||||
type: run_sql
|
||||
Reference in New Issue
Block a user