Situation #
Someone deleted or changed many records by mistake, and you want the business as it stood on an earlier day. A restore replaces everything with that day's data, so anything entered since then is missing afterwards.
What keeps working #
- Today's data stays in the data folder. The restore moves it into a
replaced-<time>folder and deletes nothing. - Drivers' queued work stays on their phones and sends again once the server returns.
Steps #
- Decide the day. Open the backup folder and read the times in the file names. Each file is the state at that time, in UTC.
- Ask everyone to stop entering data. Anything entered after the backup time will be missing, so note recent calls on paper.
- Check the file before you use it: run
dispatch-server verify-backup <file>and type the recovery key. It reports the rows and photos inside. - Stop the server.
- Run
dispatch-server restore <file> --data-dir <data folder>and type the recovery key when asked. - Read the result. It names the
replaced-<time>folder that holds today's data, and gives areset-passwordcommand for each owner. - Run those commands, start the server, and set up authenticator apps again.
- To look at the day before the mistake without committing, restore onto another computer or another data folder first. Compare, then decide.
How to confirm it worked #
- The records you lost are back and
GET /healthanswersok: true. - The row counts reported by the restore match the file's manifest. The command stops with a message when they differ.
Afterwards #
- Enter the work done since the backup from your notes and from driver phones.
- Keep the
replaced-<time>folder for a week. It holds today's database and photos, and it opens with the keys inside it. - Remove it after a week of normal work to free disk space.
- Find how the mistake happened, and give the staff member the role that fits their work. See "Roles and permissions".