(refactor) productiondb

Refactored code to handle proper deployment to a mysql database on azure when in deployment and to function properly when run locally with 'grunt local' (as long as mysql is installed on the host computer). More details in individual commits.