IO-951 IO-924 Phonebook fixes
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[]
|
||||
26
hasura/migrations/1619540860369_run_sql_migration/up.yaml
Normal file
26
hasura/migrations/1619540860369_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: "drop function search_phonebook;\nCREATE OR REPLACE FUNCTION public.search_phonebook(search
|
||||
text)\n RETURNS SETOF phonebook\n LANGUAGE plpgsql\n STABLE\nAS $function$\nBEGIN\n\tIF
|
||||
search = '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tphonebook;\n\tELSE\n\t\tRETURN
|
||||
query\n\t\tSELECT\n\t\t\tphonebook.*\n\t\tFROM\n\t\t\tphonebook\n\t\tWHERE firstname
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR lastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
company ILIKE '%' || search || '%'\n\t\t\tOR address1 ILIKE '%' || search ||
|
||||
'%'\n\t\t\tOR phone1 ILIKE '%' || search || '%'\n\t\t\tOR phone2 ILIKE '%' ||
|
||||
search || '%'\n\t\t\tOR email ILIKE '%' || search || '%'\n\t\t\tOR category
|
||||
ILIKE '%' || search || '%'\n\t\tORDER BY\n\t\t\n\t\t\tfirstname ILIKE '%' ||
|
||||
search || '%'\n\t\t\tOR NULL,\n\t\t\tlastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
NULL,\n\t\t\tcompany ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\taddress1
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tphone1 ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR NULL,\n\t\t\tphone2 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\temail
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tcategory ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_addr1
|
||||
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
|
||||
- args:
|
||||
name: search_phonebook
|
||||
schema: public
|
||||
type: track_function
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
23
hasura/migrations/1619540900896_run_sql_migration/up.yaml
Normal file
23
hasura/migrations/1619540900896_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: "drop function search_phonebook;\nCREATE OR REPLACE FUNCTION public.search_phonebook(search
|
||||
text)\n RETURNS SETOF phonebook\n LANGUAGE plpgsql\n STABLE\nAS $function$\nBEGIN\n\tIF
|
||||
search = '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tphonebook;\n\tELSE\n\t\tRETURN
|
||||
query\n\t\tSELECT\n\t\t\tphonebook.*\n\t\tFROM\n\t\t\tphonebook\n\t\tWHERE firstname
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR lastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
company ILIKE '%' || search || '%'\n\t\t\tOR address1 ILIKE '%' || search ||
|
||||
'%'\n\t\t\tOR phone1 ILIKE '%' || search || '%'\n\t\t\tOR phone2 ILIKE '%' ||
|
||||
search || '%'\n\t\t\tOR email ILIKE '%' || search || '%'\n\t\t\tOR category
|
||||
ILIKE '%' || search || '%'\n\t\tORDER BY\n\t\t\n\t\t\tfirstname ILIKE '%' ||
|
||||
search || '%'\n\t\t\tOR NULL,\n\t\t\tlastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||
NULL,\n\t\t\tcompany ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\taddress1
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tphone1 ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR NULL,\n\t\t\tphone2 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\temail
|
||||
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tcategory ILIKE '%' || search
|
||||
|| '%'\n\t\t\tOR NULL;\n\tEND IF;\nEND\n$function$;"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: search_phonebook
|
||||
schema: public
|
||||
type: track_function
|
||||
Reference in New Issue
Block a user