setting up database structure