Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Postgres trigger to delete contact_mechanisms_[addresses|phones|emails] row when related contact_mechanisms gets deleted #5

Open
lhnrd opened this issue Oct 26, 2022 · 0 comments

Comments

@lhnrd
Copy link
Owner

lhnrd commented Oct 26, 2022

Resources

Code example

CREATE FUNCTION delete_related_contact_mechanisms() 
RETURNS TRIGGER LANGUAGE PLPGSQL AS 
$$ 
BEGIN -- trigger logic
  IF OLD.contact_mechanism_address_id THEN
  END IF;
END;
$$ 

CREATE TRIGGER delete_related_contact_mechanisms
AFTER DELETE ON contact_mechanisms 
FOR EACH ROW 
EXECUTE PROCEDURE delete_related_contact_mechanisms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant