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

The dump:load command should clear the target first #10

Open
Jack12816 opened this issue Dec 13, 2017 · 1 comment
Open

The dump:load command should clear the target first #10

Jack12816 opened this issue Dec 13, 2017 · 1 comment

Comments

@Jack12816
Copy link

Jack12816 commented Dec 13, 2017

Currently the dump:load command just does not the target database structure at all. This is quite bad when it comes to a real backup load with a different migration state. It's not enough to clear and reimport all the data.

The the dump creation MUST take care of including the whole schema and the load command MUST take care of dropping the database first, recreate it, load the schema and then the data from the dump.

Looks like pg_restore is not able to this by passing --clean and --create together, due to:

When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive.

So we should drop+create the database first, with a psql statement.

--

I will come up with a PR for this soon. :)

@marcusg
Copy link
Owner

marcusg commented Dec 20, 2017

@Jack12816 sounds great! 👍

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

2 participants