<@zestyping> I think it's more important to keep staging updated than to preserve the data on staging, so I think the script that does this should wipe the database when an inability to migrate would block the update.
first upgrade buendia-db-migrate to the latest
explicitly run buendia-db-migrate to attempt a migration to the new version
if the migration succeeds, go ahead and install all the new packages
otherwise:
4a. run buendia-openmrs-dump to save a backup somewhere
4b. apt-get purge -y buendia-server, buendia-db, and buendia-db-init and any other packages that transitively depend on them
4c. delete /etc/buendia-db-init-installed
4d. install the new buendia-db-init, thus wiping and reinitializing the database
4e. install the rest of the new packages
4f. run buendia-openmrs-account-setup buendia buendia to create the OpenMRS account
4g. run buendia-openmrs-location-setup
4h. run buendia-profile-apply profile.csv where profile.csv is a recent profile, e.g. take the enfr-03.csv profile from ping.buendia.org
(copied from Slack)