testFlow/cli/migrations/migrations.go
Wyle.Gong-巩文昕 67b0ad2723 init
2025-04-22 16:42:48 +08:00

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...)
}