feat(database): add validate sql functions to migrate to new database (refs #4458)