Add --backup-id and --backup-url options to development restore command#214
Open
michaelbaudino wants to merge 1 commit intothoughtbot:mainfrom
Open
Add --backup-id and --backup-url options to development restore command#214michaelbaudino wants to merge 1 commit intothoughtbot:mainfrom
--backup-id and --backup-url options to development restore command#214michaelbaudino wants to merge 1 commit intothoughtbot:mainfrom
Conversation
ef8ec9c to
e295c58
Compare
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds 2 related options to
development restore:--backup-idallows to specify a backup id (as returned by theheroku pg:backupscommand) to restore, instead of automatically restoring the latest backup (which is still the default behavior)--backup-urlallows to specify the download URL of the backup to restore (as returned by theheroku pg:backups:urlcommand), which can be useful to users without admin access to the Heroku application (and thus, who cannot executeheroku 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 thatdevelopment restoreprovides, like reseting the local database, taking care of un-rememberablepg_restorearguments and updating environment inar_internal_metadata).Incidentally, this commit also renames the temporary file used from
tmp/latest.backuptotmp/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, sodevelopment restore production --backup-url https://…could simply bedevelopment restore --backup-url https://….But it felt more consistent to keep requiring a remote name, even if it's useless 🤷