diff options
author | Peter Smit <peter@smitmail.eu> | 2015-01-22 14:49:52 +0200 |
---|---|---|
committer | Peter Smit <peter@smitmail.eu> | 2015-01-22 14:52:58 +0200 |
commit | bb103e87239e6789b42eb4ceaab45f6cf49adb2e (patch) | |
tree | 59503b516dfa967c756c49d211180709b07896bf /models/models.go | |
parent | 161774d4fb61d1c2b28a90812b15d077312083f3 (diff) | |
download | gitea-bb103e87239e6789b42eb4ceaab45f6cf49adb2e.tar.gz gitea-bb103e87239e6789b42eb4ceaab45f6cf49adb2e.zip |
Create db migrations framework
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go index cf2124417a..55e7bf5822 100644 --- a/models/models.go +++ b/models/models.go @@ -15,6 +15,7 @@ import ( "github.com/go-xorm/xorm" _ "github.com/lib/pq" + "github.com/gogits/gogs/models/migrations" "github.com/gogits/gogs/modules/setting" ) @@ -131,6 +132,11 @@ func NewEngine() (err error) { if err = SetEngine(); err != nil { return err } + + if err = migrations.Migrate(x); err != nil { + return err + } + if err = x.StoreEngine("InnoDB").Sync2(tables...); err != nil { return fmt.Errorf("sync database struct error: %v\n", err) } |