- args:
    cascade: true
    sql: "CREATE OR REPLACE FUNCTION public.assign_ro_number()\r\n RETURNS trigger\r\n
      LANGUAGE plpgsql\r\nAS $function$\r\n      begin\r\n        IF NEW.converted
      = true and (new.ro_number is null or new.ro_number = '') THEN\r\n           UPDATE
      counters\r\n\tSET count = count + 1 where shopid=new.shopid AND countertype
      = 'ronum'\r\n\tRETURNING concat(prefix,count) into new.ro_number;\r\n\r\n        END
      IF;\r\n        RETURN NEW;\r\n      END;\r\n  $function$\r\n;\r\n"
  type: run_sql
