Skip to content

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

@Jack12816

Description

@Jack12816

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. :)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions