Create associations between tables and add tests