Fix migration writing file only when migrated.