From 5dfd15ece2d3780f863589d1d71a48739aba0e8a Mon Sep 17 00:00:00 2001 From: Liam Staskawicz Date: Wed, 25 Sep 2013 11:37:19 -0700 Subject: [PATCH] ensureDBVersion(): clean up after the db version query. fixes issue #10. --- migrate.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migrate.go b/migrate.go index 17868bc..10200d9 100644 --- a/migrate.go +++ b/migrate.go @@ -196,13 +196,12 @@ func ensureDBVersion(conf *DBConf, db *sql.DB) (int64, error) { rows, err := conf.Driver.Dialect.dbVersionQuery(db) if err != nil { - if err == ErrTableDoesNotExist { return 0, createVersionTable(conf, db) } - return 0, err } + defer rows.Close() // The most recent record for each migration specifies // whether it has been applied or rolled back.