Skip to content

Instantly share code, notes, and snippets.

@jaredjburgess
Created February 21, 2016 14:35
Show Gist options
  • Save jaredjburgess/b92570074086db8a8245 to your computer and use it in GitHub Desktop.
Save jaredjburgess/b92570074086db8a8245 to your computer and use it in GitHub Desktop.
PostgreSQL syntax to create a foreign key on an existing table
alter table table_name add constraint table_name_column_name_fkey foreign key (column_name) references other_table_name (other_column_name) on delete cascade;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment