Files
bodyshop/hasura/migrations/1619039746435_run_sql_migration/up.yaml
2021-04-21 14:31:40 -07:00

18 lines
883 B
YAML

- args:
cascade: false
read_only: false
sql: "drop function public.search_exportlog;\r\n\r\nCREATE\r\nOR REPLACE FUNCTION
public.search_exportlog(search text) RETURNS SETOF exportlog LANGUAGE plpgsql
STABLE AS $function$ BEGIN IF search = '' THEN RETURN query\r\nSELECT\r\n *\r\nFROM\r\n
\ exportlog e;\r\n ELSE RETURN query\r\nSELECT\r\n e.*\r\nFROM\r\n exportlog
e,\r\n jobs j,\r\n payments p,\r\n bills b\r\nWHERE\r\n(e.jobid = j.id and
\ j.ro_number ILIKE '%' || search || '%') OR\r\n(e.paymentid = p.id and p.paymentnum
ILIKE '%' || search || '%') OR\r\n(e.billid = b.id and b.invoice_number ILIKE
'%' || search || '%') OR\r\n e.useremail ILIKE '%' || search || '%'\r\n\r\n
\r\n \r\n;\r\nEND IF;\r\nEND $function$;"
type: run_sql
- args:
name: search_exportlog
schema: public
type: track_function