refactor migration script to reuse code
string replace frozenset