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

Don't overwrite existing dump file by default, make database name clearer #1184

Merged
merged 6 commits into from
Jul 13, 2024

Conversation

Dhghomon
Copy link
Contributor

@Dhghomon Dhghomon commented Dec 4, 2023

Having a database dump instantaneously overwrite any existing files of the same name has always made me a bit nervous and I think we should require the user to add an --overwrite-existing to the command to make this behaviour explicit. Some current users may be annoyed but edgedb dump --help will quickly show the option to overwrite and I think it's best to get this out of the way now, much better than a panicked "I mistakenly overwrote some incredibly crucial file and is there any way to restore it...?" issue later on.

The current behaviour calls create() which makes an OpenOptions with the following parameters set:

https://doc.rust-lang.org/src/std/fs.rs.html#394

So keep that in case of overwrite-existing, and use .create_new() otherwise.

When using --all I think automatic overwriting is fine as is since the user has to specify a directory, and the PR adds a note to that effect that using --all will have this effect. Also dump_all() is used when upgrading an instance so best to leave that untouched.

Also noticed that having the default database be edgedb makes the output a bit unclear sometimes:

"Starting dump for edgedb", "Finished dump for edgedb" and "Database edgedb dump" all look like it might be referring to EdgeDB in general. So just add some ticks around the database name.

make database name output clearer
@Dhghomon Dhghomon marked this pull request as ready for review December 4, 2023 04:12
src/commands/dump.rs Outdated Show resolved Hide resolved
@fantix fantix requested a review from mmastrac July 12, 2024 22:16
Copy link
Contributor

@mmastrac mmastrac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@fantix fantix merged commit 222d787 into master Jul 13, 2024
17 checks passed
@fantix fantix deleted the do-not-overwrite-dump-file-by-default branch July 13, 2024 00:04
msullivan added a commit to edgedb/edgedb that referenced this pull request Jul 13, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Jul 13, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Jul 13, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 21, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 21, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 21, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 21, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 22, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
msullivan added a commit to edgedb/edgedb that referenced this pull request Aug 22, 2024
edgedb/edgedb-cli#1184 made dump refuse to overwrite files by default,
which broke our dump tests.

We could fix it by passing the flag to allow overwriting to the CLI,
but it seems more natural to make a temp *directory* instead of
overwriting a temp file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants