Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active April 18, 2022 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/1fe0ce030e532a67ef1b1aec64c440f8 to your computer and use it in GitHub Desktop.
Save garystafford/1fe0ce030e532a67ef1b1aec64c440f8 to your computer and use it in GitHub Desktop.
-- wrap in transaction
BEGIN;
-- customers.customer
ALTER TABLE IF EXISTS customers.customer
DROP CONSTRAINT IF EXISTS customer_address_id_fkey;
ALTER TABLE IF EXISTS customers.customer
ADD CONSTRAINT customer_address_id_fkey FOREIGN KEY (address_id)
REFERENCES customers.address (address_id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE RESTRICT;
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment