Allow migrations to be environment agnostic

I didn't find lib/bin/cli.js tests. I think they don't exist. Maybe they should be added later. Closes #328.