Skip to content

Add --backup-id and --backup-url options to development restore command#214

Open
michaelbaudino wants to merge 1 commit intothoughtbot:mainfrom
michaelbaudino:main
Open

Add --backup-id and --backup-url options to development restore command#214
michaelbaudino wants to merge 1 commit intothoughtbot:mainfrom
michaelbaudino:main

Conversation

@michaelbaudino
Copy link

This commit adds 2 related options to development restore:

  • --backup-id allows to specify a backup id (as returned by the heroku pg:backups command) to restore, instead of automatically restoring the latest backup (which is still the default behavior)
  • --backup-url allows to specify the download URL of the backup to restore (as returned by the heroku pg:backups:url command), which can be useful to users without admin access to the Heroku application (and thus, who cannot execute heroku pg:backups:url): they can now fetch the backup from another channel (e.g. an admin team mate) and restore it locally as if it came directly from Heroku (with all the nice things that development restore provides, like reseting the local database, taking care of un-rememberable pg_restore arguments and updating environment in ar_internal_metadata).

Incidentally, this commit also renames the temporary file used from tmp/latest.backup to tmp/parity.backup, since the backup stored temporarily is not always the latest one ⬅️ I don't know if this is considered a breaking change, but if so, we can remove it from this PR.

Note

Technically, when using --backup-url, the git remote name is unused, so development restore production --backup-url https://… could simply be development restore --backup-url https://….
But it felt more consistent to keep requiring a remote name, even if it's useless 🤷

@michaelbaudino michaelbaudino force-pushed the main branch 2 times, most recently from ef8ec9c to e295c58 Compare March 20, 2026 16:46
… command

This commit adds 2 related options to `development restore`:
* `--backup-id` allows to specify a backup id (as returned by the `heroku pg:backups` command) to restore, instead of automatically restoring the latest backup (which is still the default behavior)
* `--backup-url` allows to specify the download URL of the backup to restore (as returned by the `heroku pg:backups:url` command), which can be useful to users without admin access to the Heroku application (and thus, who cannot execute `heroku pg:backups:url`): they can now fetch the backup from another channel (e.g. an admin team mate) and restore it locally as if it came directly from Heroku (with all the nice things that `development restore` provides, like reseting the local database, taking care of un-rememberable `pg_restore` arguments and updating environment in `ar_internal_metadata`).

Incidentally, this commit also renames the temporary file used from `tmp/latest.backup` to `tmp/parity.backup`, since the backup stored temporarily is not always the latest one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant