added database migration files
refactored code to calculate total score