mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Create db migrations framework
This commit is contained in:
parent
161774d4fb
commit
bb103e8723
2 changed files with 53 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue