Resolved trigger issue for payment/ihb numbers.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
[]
|
||||
11
hasura/migrations/1614196402453_run_sql_migration/up.yaml
Normal file
11
hasura/migrations/1614196402453_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: "CREATE OR REPLACE FUNCTION public.assign_ibh_number()\n RETURNS trigger\n
|
||||
LANGUAGE plpgsql\nAS $function$\n begin\n IF NEW.isinhouse = true
|
||||
and (new.invoice_number is null or new.invoice_number = 'ih') THEN\n UPDATE
|
||||
counters\n\tSET count = count + 1\n\twhere shopid = (select shopid from jobs
|
||||
where jobs.id = new.jobid)\n\tAND countertype = 'ihbnum'\n\tRETURNING concat(prefix,count)
|
||||
into new.invoice_number;\n\n END IF;\n RETURN NEW;\n END;\n
|
||||
\ $function$;"
|
||||
type: run_sql
|
||||
Reference in New Issue
Block a user