mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-15 07:06:35 +08:00
增加SQL子版本
This commit is contained in:
@@ -2,7 +2,6 @@ package setup
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/errors"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs"
|
||||
@@ -113,7 +112,7 @@ func (this *SQLExecutor) checkData(db *dbs.DB) error {
|
||||
}
|
||||
|
||||
// 更新版本号
|
||||
err = this.updateVersion(db, teaconst.Version)
|
||||
err = this.updateVersion(db, ComposeSQLVersion())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
20
internal/setup/utils.go
Normal file
20
internal/setup/utils.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package setup
|
||||
|
||||
import (
|
||||
teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ComposeSQLVersion() string {
|
||||
var version = teaconst.Version
|
||||
if len(teaconst.SQLVersion) == 0 {
|
||||
return version
|
||||
}
|
||||
|
||||
if strings.Count(version, ".") <= 2 {
|
||||
return version + "." + teaconst.SQLVersion
|
||||
}
|
||||
return version
|
||||
}
|
||||
12
internal/setup/utils_test.go
Normal file
12
internal/setup/utils_test.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package setup_test
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/setup"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestComposeSQLVersion(t *testing.T) {
|
||||
t.Log(setup.ComposeSQLVersion())
|
||||
}
|
||||
Reference in New Issue
Block a user