Fix after initialize db callback

This commit is contained in:
Jinzhu 2021-03-05 14:12:55 +08:00
parent 1476b2f7d4
commit 294625759c
1 changed files with 3 additions and 1 deletions

View File

@ -114,7 +114,9 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) {
if err := opt.Apply(config); err != nil { if err := opt.Apply(config); err != nil {
return nil, err return nil, err
} }
defer opt.AfterInitialize(db) defer func() {
opt.AfterInitialize(db)
}()
} }
} }