feat:完善项目信息
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user