While working on a product at some point we had a bad import of data. Unfortunately it was so straight forward to get the data back and the data that we DID import did not come with all the constraints that the original had. Here is how I added them using postgres:

alter table <table> add constraint <constraint name> primary key (<column name>);