Skip to content

Commit 9eb2cce

Browse files
committed
数据库升级时表名不区分大小写/增加一些注释
1 parent 7217785 commit 9eb2cce

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

cmd/sql-dump/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ import (
5252
"github.com/iwind/TeaGo/logs"
5353
)
5454
55-
// 最新的SQL语句
56-
// 由sql-dump/main.go自动生成
57-
55+
// 最新版本的数据库SQL语句,用来对比并升级已有的数据库
56+
// 由 sql-dump/main.go 自动生成
5857
func init() {
5958
err := json.Unmarshal([]byte(` + strconv.Quote(string(resultsJSON)) + `), LatestSQLResult)
6059
if err != nil {

internal/setup/sql.go

Lines changed: 3 additions & 4 deletions
Large diffs are not rendered by default.

internal/setup/sql_dump.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewSQLDump() *SQLDump {
3434
return &SQLDump{}
3535
}
3636

37-
// 导出数据
37+
// Dump 导出数据
3838
func (this *SQLDump) Dump(db *dbs.DB) (result *SQLDumpResult, err error) {
3939
result = &SQLDumpResult{}
4040

@@ -107,7 +107,7 @@ func (this *SQLDump) Dump(db *dbs.DB) (result *SQLDumpResult, err error) {
107107
return
108108
}
109109

110-
// 应用数据
110+
// Apply 应用数据
111111
func (this *SQLDump) Apply(db *dbs.DB, newResult *SQLDumpResult) (ops []string, err error) {
112112
currentResult, err := this.Dump(db)
113113
if err != nil {

internal/setup/sql_dump_result.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package setup
22

3+
import "strings"
4+
35
type SQLDumpResult struct {
46
Tables []*SQLTable `json:"tables"`
57
}
68

79
func (this *SQLDumpResult) FindTable(tableName string) *SQLTable {
810
for _, table := range this.Tables {
9-
if table.Name == tableName {
11+
if strings.ToLower(table.Name) == strings.ToLower(tableName) {
1012
return table
1113
}
1214
}

0 commit comments

Comments
 (0)