added migration of affiliate, format validation and tests