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

Add restore command #321

Closed
asdine opened this issue Nov 14, 2020 · 3 comments
Closed

Add restore command #321

asdine opened this issue Nov 14, 2020 · 3 comments
Labels
cli Command line
Milestone

Comments

@asdine
Copy link
Collaborator

asdine commented Nov 14, 2020

$ genji restore -h
NAME:
   genji restore - Restore a database or a table from a file created by genji dump

USAGE:
   genji restore dumpFile dbPath

DESCRIPTION:
  The restore command can restore a database or a table from a text file.

  $ genji restore dump.sql my.db 

OPTIONS:
   --help, -h                show help (default: false)
@asdine asdine added the cli Command line label Nov 14, 2020
@asdine asdine added this to the v0.10.0 milestone Nov 14, 2020
@yaziine
Copy link
Collaborator

yaziine commented Nov 19, 2020

I think it should take more flags for specifying the table and the engine to use:

$ genji restore -h
NAME:
   genji restore - Restore a database or a table from a file created by genji dump

USAGE:
   genji restore [options] dumpFile dbPath

DESCRIPTION:
  The restore command can restore a database or a table from a text file.

  $ genji restore dump.sql my.db 

OPTIONS:
   --engine, -e            name of the engine to use, options are 'bolt' or 'badger'. Default to 'bolt'
   --table, -t             name of the table to restore. Default to all tables
   --help, -h              show help (default: false)

If the database at dbPath doesn't exist, it should be created given the specified engine. However, if it exists, the engine flag is ignored.

@asdine asdine modified the milestones: v0.10.0, v0.11.0 Jan 26, 2021
@tzzed
Copy link
Contributor

tzzed commented Feb 27, 2021

I think the --table option is not usefull in this case. Restoring a table from a "dump" file seems weird. In my point of view, it will be more simplest and usefull in a .restore command.
What is the expected behavior if the dbPath exists? Should the file be overwritten?
Return an error? It currently returns error: table already exists for the CREATE query.

@asdine
Copy link
Collaborator Author

asdine commented Mar 2, 2021

I think the --table option is not usefull in this case

Agreed

What is the expected behavior if the dbPath exists? Should the file be overwritten? Return an error? It currently returns error: table already exists for the CREATE query.

I think this is good enough, we can leave it like that

@asdine asdine closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Command line
Projects
None yet
Development

No branches or pull requests

3 participants