summaryrefslogtreecommitdiff
path: root/sql/legacy/Pg-upgrade-2.3.9-2.4.2.sql
blob: 4e91e473415a270df538b30c0417b5ba115b2abd (plain)
  1. --
  2. drop trigger del_customer on customer;
  3. drop trigger del_vendor on vendor;
  4. drop function del_customer();
  5. drop function del_vendor();
  6. --
  7. create function del_customer() returns opaque as '
  8. begin
  9. delete from shipto where trans_id = old.id;
  10. delete from customertax where customer_id = old.id;
  11. delete from partscustomer where customer_id = old.id;
  12. return NULL;
  13. end;
  14. ' language 'plpgsql';
  15. -- end function
  16. --
  17. create trigger del_customer after delete on customer for each row execute procedure del_customer();
  18. -- end trigger
  19. --
  20. create function del_vendor() returns opaque as '
  21. begin
  22. delete from shipto where trans_id = old.id;
  23. delete from vendortax where vendor_id = old.id;
  24. delete from partsvendor where vendor_id = old.id;
  25. return NULL;
  26. end;
  27. ' language 'plpgsql';
  28. -- end function
  29. --
  30. create trigger del_vendor after delete on vendor for each row execute procedure del_vendor();
  31. -- end trigger
  32. --
  33. update defaults set version = '2.4.2';