feat:完善项目信息

This commit is contained in:
henry
2021-12-28 17:14:02 +08:00
parent ae25321694
commit 40168a30b3
12 changed files with 339 additions and 70 deletions

View File

@ -1,6 +1,9 @@
package migrate
import (
"SciencesServer/app/common/migrate"
"SciencesServer/serve/orm"
"SciencesServer/serve/orm/logic"
"fmt"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
@ -63,19 +66,19 @@ func run() {
fmt.Println("========================\n=== 初始化项目配置 ===\n========================")
// 初始化数据引擎
//engine := orm.NewInstance(
// orm.WithDBMode(mode),
// orm.WithMysqlOption(&logic.Mysql{
// Host: _mysql.Host, Port: _mysql.Port,
// Username: _mysql.Username, Password: _mysql.Password,
// Database: _mysql.Database, Parameters: "charset=utf8mb4,utf8&parseTime=True&loc=Local",
// }),
// orm.WithSqliteOption(&logic.Sqlite{Path: _sqlite.Path, Name: _sqlite.Name}),
//).Init()
engine := orm.NewInstance(
orm.WithDBMode(mode),
orm.WithMysqlOption(&logic.Mysql{
Host: _mysql.Host, Port: _mysql.Port,
Username: _mysql.Username, Password: _mysql.Password,
Database: _mysql.Database, Parameters: "charset=utf8mb4,utf8&parseTime=True&loc=Local",
}),
orm.WithSqliteOption(&logic.Sqlite{Path: _sqlite.Path, Name: _sqlite.Name}),
).Init()
fmt.Println("========================\n=== 数据引擎创建成功 ===\n========================")
// 迁移数据
//migrate.NewInstance(migrate.WithGormDBOption(engine.Engine)).Handle()
migrate.NewInstance(migrate.WithGormDBOption(engine.Engine)).Handle()
if err := saveFile(file, &Config{
Debug: true,