Adding foreign keys for cv tables