setting up database and associations