Merge pull request #192 from msdinit/examples/close-db-connection

Close DB connection after migration is complete
pull/210/head
Vojtech Vitek 2020-04-11 17:38:21 +02:00 committed by GitHub
commit 89caaf7829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -61,6 +61,11 @@ func main() {
if err != nil {
log.Fatalf("-dbstring=%q: %v\n", dbstring, err)
}
defer func() {
if err := db.Close(); err != nil {
log.Fatalf("goose: failed to close DB: %v\n", err)
}
}()
arguments := []string{}
if len(args) > 3 {

View File

@ -33,6 +33,12 @@ func main() {
log.Fatalf("goose: failed to open DB: %v\n", err)
}
defer func() {
if err := db.Close(); err != nil {
log.Fatalf("goose: failed to close DB: %v\n", err)
}
}()
arguments := []string{}
if len(args) > 3 {
arguments = append(arguments, args[3:]...)