added foreign keys and validations to all tables