Skip to content

Commit 22e1d56

Browse files
Prometheus2677FPiety0521
authored and
FPiety0521
committed
Merge pull request #360 from Rocketmakers/drop-prompt
Prompt before dropping the entire database
2 parents a679a77 + 5342d4e commit 22e1d56

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/cli/main.go

+11
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,17 @@ Database drivers: `+strings.Join(database.List(), ", ")+"\n")
227227
}
228228

229229
case "drop":
230+
log.Println("Are you sure you want to drop the entire database schema? [y/N]")
231+
var response string
232+
fmt.Scanln(&response)
233+
response = strings.ToLower(strings.TrimSpace(response))
234+
235+
if response == "y" {
236+
log.Println("Dropping the entire database schema")
237+
} else {
238+
log.fatal("Aborted dropping the entire database schema")
239+
}
240+
230241
if migraterErr != nil {
231242
log.fatalErr(migraterErr)
232243
}

0 commit comments

Comments
 (0)