Foreign keys now correctly added to database