android
android copied to clipboard
Add checks to verify DB migrations are actually done.
Summary
With any luck this will fail builds if migrations are missing or incorrectly updating existing migrations.
Screenshots
N/A
Link to pull request in Documentation repository
N/A
Any other notes
Wouldn't it be better to run these checks as soon as possible (modified almost immediately, missing after building)? I can't think of a reason to build or archive the app if the action is going to fail because of changed or missing DB schema files.
So we at least need the second one after the build to check to see if a change was made to code that would affect the schema. It would manifest as an uncommitted change. And since that one needs to be done after a build I just put both after the build.
Another scenario which isn't working: bumped the database version but didn't add the schema file to git. Example PR: https://github.com/jpelgrom/home-assistant-android/pull/4
The existing checks only seem to consider changes to existing files or staged changes, but after Gradle is done building new files aren't staged
@JBassett Is it OK if I have a go at fixing/implementing this? There haven't been a lot of database changes recently but this is still nice to have
@jpelgrom have at it, life/work has kept me on a review only basis for a while now. Thanks!