Fixed SQL database foreign keys.