Core Data Migrations: you hope you never have to write them yourself.
This week's story will tell you that our Collect app experienced many of those so-called "heavyweight migrations".
Whenever you can, you should prevent yourself from writing them. Even after 3 years of experience, I'm still fixing edge case bugs for our application related to Core Data migrations. I'm not able to explain to you how to do heavyweight migrations now but I can highly recommend reading
Donny's book on Core Data which covers migrations.
What I can share with you is that our
Diagnostics framework helped a lot with fixing migration issues. We've built-in an alert that allows users to share a diagnostics report whenever a migration failure occurs. The report contains a detailed error explaining to us the cause of the failure.
You can't prevent bugs but you can prevent yourself from not having any details once a bug occurred. Our development process around fixing bugs has improved a lot since Diagnostics arrived and it even allows our support team to pre-check states like "is the user updated to our latest app" instead of dropping an issue with our team and letting us say "this is fixed in the latest release".
Enjoy this week's SwiftLee Weekly!