From 450969c158d36e40b28b89f4fcb0ed89f885ea01 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 24 Nov 2016 22:30:36 +0800 Subject: [PATCH] test database is connect OK after db config initialized (#239) --- models/models.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/models.go b/models/models.go index a95468e0361..3a83929a77b 100644 --- a/models/models.go +++ b/models/models.go @@ -196,6 +196,10 @@ func NewEngine() (err error) { return err } + if err = x.Ping(); err != nil { + return err + } + if err = migrations.Migrate(x); err != nil { return fmt.Errorf("migrate: %v", err) }