init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"app/cfg"
|
||||
"app/models"
|
||||
"app/models/project"
|
||||
"app/models/project/stage"
|
||||
"app/models/project/stage/tools"
|
||||
)
|
||||
|
||||
// Run executes all pending migrations
|
||||
func main() {
|
||||
// 初始化数据库连接
|
||||
var db = cfg.DB()
|
||||
|
||||
// 在这里添加所有的迁移
|
||||
migrations := []interface{}{
|
||||
models.Stage{},
|
||||
models.GraphLink{},
|
||||
models.GraphNode{},
|
||||
models.Tree{},
|
||||
models.Endpoint{},
|
||||
models.Doc{},
|
||||
models.Project{},
|
||||
models.Response{},
|
||||
models.Demand{},
|
||||
project.Demand{},
|
||||
project.Stage{},
|
||||
stage.GraphLink{},
|
||||
stage.GraphNode{},
|
||||
tools.Endpoint{},
|
||||
}
|
||||
|
||||
// 执行迁移
|
||||
var _ = db.AutoMigrate(migrations...)
|
||||
}
|
||||
Reference in New Issue
Block a user