I have the following set up,
CREATE TABLE auth_user ( id int PRIMARY KEY );
CREATE TABLE links_chatpicmessage ();
I\'m trying to add a
I know this answer is way late, and I realize this is the same as btubbs one-liner, just a little more descriptive ...
Assuming you want to reference the primary key in table auth_user and that key name is 'id'.
I use this syntax:
ALTER TABLE links_chatpicmessage
ADD COLUMN sender some_type,
ADD FOREIGN KEY (sender) REFERENCES auth_user(id);
Note: some_type = [type the same as sender in table auth_user]