37 lines
641 B
Go
37 lines
641 B
Go
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...)
|
|
}
|