Commit 6ef9887c authored by Will Cory's avatar Will Cory Committed by Will Cory

defer db.close

parent 93aedf72
......@@ -104,7 +104,7 @@ func dbFromGormTx(tx *gorm.DB) *DB {
}
func (db *DB) ExecuteSQLMigration() error {
err := filepath.Walk("migrations", func(path string, info os.FileInfo, err error) error {
err := filepath.Walk("./migrations", func(path string, info os.FileInfo, err error) error {
// Check for any walking error
if err != nil {
return errors.Wrap(err, fmt.Sprintf("Failed to process migration file: %s", path))
......
......@@ -139,9 +139,9 @@ func setupTestDatabase(t *testing.T) string {
}
// NewDB will create the database schema
db, err := database.NewDB(dbConfig)
err = db.ExecuteSQLMigration()
require.NoError(t, err)
err = db.Close()
defer db.Close()
err = db.ExecuteSQLMigration()
require.NoError(t, err)
t.Logf("database %s setup and migrations executed", dbName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment