thoughtbot / parity

Shell commands for development, staging, and production parity for Heroku apps
https://thoughtbot.com
MIT License
889 stars 57 forks source link

Feature request: specify the database to pull from #171

Open mjankowski opened 5 years ago

mjankowski commented 5 years ago

This came up in Slack today -- it would be PLEASANT if you could do something like development restore production PINK and parity would know to pull the most recent backup from the named DB in the relevant remote. Yes sir.

In the use case being discussed there was a read-only follower set up which was backed up more regularly than the "main" DATABASE_URL db on the remote.

geoffharcourt commented 5 years ago

This is a great idea, I'm hoping to work on it this month.

geoffharcourt commented 5 years ago

@mjankowski this turns out to be not straightforward at all. heroku pg:backups:url, which is how we currently fetch URLs, can take a backup ID, but it can't take a database name (unlike many of the other pg subcommands). We would certainly benefit from doing this, so I'd like to see it happen, but I think it requires a significant reworking of how we get backup URLs.

mjankowski commented 5 years ago

Yeah... we'd need something like -- use pg:backups, parse out the lines, find the first one matching the correct DB name, get the backup ID for that, request the URL for that backup ID, etc. Sort of clunky compared to current for sure.

mjankowski commented 5 years ago

I wonder if the Heroku CLI maintainers would feel about a request to add a --database flag (or just the name as an argument) to the pg:backups command, and have it return only backups on that db? That would let us more directly get the latest backup and/or ID for the DB we want.

geoffharcourt commented 5 years ago

Yeah, I think without that we're going to be reduced to a lot of JSON and stdout parsing that will add fragility.

geoffharcourt commented 4 years ago

@mjankowski we're no longer using Heroku for PG, so my work on this is not going to move nearly as fast. If there's a thoughtbuddy working on a project with followers who can work on this I'd love to see it make it into the library.

jakemumu commented 1 year ago

would love to see this feature added still <3