mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
数据库升级时表名不区分大小写/增加一些注释
This commit is contained in:
@@ -52,9 +52,8 @@ import (
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
)
|
||||
|
||||
// 最新的SQL语句
|
||||
// 最新版本的数据库SQL语句,用来对比并升级已有的数据库
|
||||
// 由 sql-dump/main.go 自动生成
|
||||
|
||||
func init() {
|
||||
err := json.Unmarshal([]byte(` + strconv.Quote(string(resultsJSON)) + `), LatestSQLResult)
|
||||
if err != nil {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -34,7 +34,7 @@ func NewSQLDump() *SQLDump {
|
||||
return &SQLDump{}
|
||||
}
|
||||
|
||||
// 导出数据
|
||||
// Dump 导出数据
|
||||
func (this *SQLDump) Dump(db *dbs.DB) (result *SQLDumpResult, err error) {
|
||||
result = &SQLDumpResult{}
|
||||
|
||||
@@ -107,7 +107,7 @@ func (this *SQLDump) Dump(db *dbs.DB) (result *SQLDumpResult, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// 应用数据
|
||||
// Apply 应用数据
|
||||
func (this *SQLDump) Apply(db *dbs.DB, newResult *SQLDumpResult) (ops []string, err error) {
|
||||
currentResult, err := this.Dump(db)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package setup
|
||||
|
||||
import "strings"
|
||||
|
||||
type SQLDumpResult struct {
|
||||
Tables []*SQLTable `json:"tables"`
|
||||
}
|
||||
|
||||
func (this *SQLDumpResult) FindTable(tableName string) *SQLTable {
|
||||
for _, table := range this.Tables {
|
||||
if table.Name == tableName {
|
||||
if strings.ToLower(table.Name) == strings.ToLower(tableName) {
|
||||
return table
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user