package initialize import ( "git.echol.cn/loser/logger/log" "online_code/client" "online_code/models/entity" ) // 初始化数据库表 func databaseTable() { dbs := []any{ new(entity.User), new(entity.Category), new(entity.Problem), new(entity.ProblemCategory), new(entity.Submit), new(entity.TestCase), } if err := client.MySQL.AutoMigrate(dbs...); err != nil { log.Panicf("数据库表预初始化处理:%s", err.Error()) } log.Debugf("数据库表预初始化处理完成") }