Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Fixed handling for a dbName that do not exist in the backup being res…
Browse files Browse the repository at this point in the history
…tored (#148)

* Fixed handling for a dbName that do not exist in the backup being restored

* Fixed handling for a dbName that do not exist in the backup being restored
  • Loading branch information
Kolbe Kegel authored Feb 1, 2020
1 parent 0a43d2a commit 3863a3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func runRestore(flagSet *flag.FlagSet, cmdName, dbName, tableName string) error
case len(dbName) != 0 && len(tableName) == 0:
// database restore
db := client.GetDatabase(dbName)
if db == nil {
return errors.Errorf("database %s not found in backup", dbName)
}
err = client.CreateDatabase(db.Schema)
if err != nil {
return errors.Trace(err)
Expand All @@ -122,6 +125,9 @@ func runRestore(flagSet *flag.FlagSet, cmdName, dbName, tableName string) error
case len(dbName) != 0 && len(tableName) != 0:
// table restore
db := client.GetDatabase(dbName)
if db == nil {
return errors.Errorf("database %s not found in backup", dbName)
}
err = client.CreateDatabase(db.Schema)
if err != nil {
return errors.Trace(err)
Expand Down

0 comments on commit 3863a3a

Please sign in to comment.