mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-29 23:46:00 -05:00
f01f523c2c
In hindsight, the "post_tx" step in the upgrade process introduced in e7f5733 doesn't make sense. If the procedure fails at this stage, nothing says it still needs to be completed. If the sample file dirs have to be updated after the database, then there should be another database version to mark that it's fully completed, and indeed that's the purpose version 3 serves. So get rid of the Upgrader trait and just go back to a simple run function per version. In the case of the sample file dir metadata, it actually can happen before the database transaction; the stuff written to the database later just needs to be consistent with what it finds if there's an existing metadata file from a half-completed update. For safety, ensure there are no unexpected directory contents before upgrading 1->2, and ensure the metadata matches before upgrading 2->3.