Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add flag to use the downloaded database #189

Open
tannakartikey opened this issue Feb 25, 2021 · 3 comments
Open

Feature request: add flag to use the downloaded database #189

tannakartikey opened this issue Feb 25, 2021 · 3 comments

Comments

@tannakartikey
Copy link

I have frequently come across situations during the development where I have to restore the development database multiple times in a short time, where it does not make sense to download the remote database again.

If the maintainers think that the option to use the already downloaded database will help, I can work on the same.

@geoffharcourt
Copy link
Collaborator

Hi @tannakartikey I think this is a great idea, please go ahead with a pull request.

@tannakartikey
Copy link
Author

@geoffharcourt I was thinking to introduce --cached flag to convey that the user wants to restore from the database downloaded earlier.

At the moment, the local database is deleted by the delete_local_temp_backup method after the database is restored. What should we do about it?

def restore_to_development
ensure_temp_directory_exists
download_remote_backup
wipe_development_database
restore_from_local_temp_backup
delete_local_temp_backup
delete_rails_production_environment_settings
end

@croaky
Copy link
Contributor

croaky commented Nov 20, 2021

Possibly some ideas in here https://dancroak.com/heroku-postgres-restore-staging-development which is based originally on Parity code. My shell history frequently contains lines like:

db-restore-stag-from-prod-backup && db-backup-stag && db-download-stag-backup && db-restore-dev-from-downloaded-backup

The use case you described is the last command since there's a tmp/latest.backup sitting on the filesystem:

db-restore-dev-from-downloaded-backup

I'd recommend flagging delete_local_temp_backup as you say and considering whether the default should be to keep the backup on the filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants