refactoring `File` and `Migration` logic