mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 17:40:24 +08:00
使用并发队列安装和升级数据表/启动时自动调整MySQL变量
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSQLDump_Dump(t *testing.T) {
|
||||
@@ -62,15 +63,20 @@ func TestSQLDump_Apply(t *testing.T) {
|
||||
_ = db.Close()
|
||||
}()
|
||||
|
||||
dump := NewSQLDump()
|
||||
var dump = NewSQLDump()
|
||||
result, err := dump.Dump(db)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var before = time.Now()
|
||||
defer func() {
|
||||
t.Log("cost:", time.Since(before))
|
||||
}()
|
||||
|
||||
db2, err := dbs.NewInstanceFromConfig(&dbs.DBConfig{
|
||||
Driver: "mysql",
|
||||
Dsn: "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&timeout=30s",
|
||||
Dsn: "root:123456@tcp(192.168.2.60:3306)/db_edge_new?charset=utf8mb4&timeout=30s",
|
||||
Prefix: "edge",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -84,9 +90,10 @@ func TestSQLDump_Apply(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("ok")
|
||||
if len(ops) > 0 {
|
||||
/**if len(ops) > 0 {
|
||||
for _, op := range ops {
|
||||
t.Log("", op)
|
||||
}
|
||||
}
|
||||
}**/
|
||||
_ = ops
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user