I am trying to set primary key on a column (which references a parent table), but I get an error
CREATE TABLE IF NOT EXISTS matches
(
id serial,
user_id PRIMARY KEY REFERENCES users(id) ON DELETE CASCADE,
matched_profile REFERENCES profiles(id) ON DELETE CASCADE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_on TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
UNIQUE (user_id, matched_profile)
);
Not sure what's wrong here, if anyone could explain. Thanks!