android icon indicating copy to clipboard operation
android copied to clipboard

Add checks to verify DB migrations are actually done.

Open JBassett opened this issue 3 years ago • 3 comments

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

JBassett avatar Mar 28 '22 01:03 JBassett

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.

jpelgrom avatar Mar 28 '22 15:03 jpelgrom

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.

JBassett avatar Mar 28 '22 20:03 JBassett

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

jpelgrom avatar May 01 '22 19:05 jpelgrom

@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 avatar Oct 21 '22 19:10 jpelgrom

@jpelgrom have at it, life/work has kept me on a review only basis for a while now. Thanks!

JBassett avatar Oct 21 '22 19:10 JBassett