You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
774 B
35 lines
774 B
package initialize
|
|
|
|
import (
|
|
"os"
|
|
|
|
"autocode/global"
|
|
"autocode/model/autocode"
|
|
"go.uber.org/zap"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Gorm 初始化数据库并产生数据库全局变量
|
|
// Author SliverHorn
|
|
func Gorm() *gorm.DB {
|
|
return GormInit()
|
|
}
|
|
|
|
// RegisterTables 注册数据库表专用
|
|
// Author SliverHorn
|
|
func RegisterTables(db *gorm.DB) {
|
|
err := db.AutoMigrate(
|
|
|
|
// 自动化模块表
|
|
// Code generated by github.com/flipped-aurora/yibu/server Begin; DO NOT EDIT.
|
|
autocode.AutoCodeExample{},
|
|
autocode.UserInfo{},
|
|
autocode.Ercode{},
|
|
// Code generated by github.com/flipped-aurora/yibu/server End; DO NOT EDIT.
|
|
)
|
|
if err != nil {
|
|
global.GVA_LOG.Error("register table failed", zap.Error(err))
|
|
os.Exit(0)
|
|
}
|
|
global.GVA_LOG.Info("register table success")
|
|
}
|