Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions agent/utils/mysql/client/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"crypto/tls"
"crypto/x509"
"database/sql"
"errors"

"github.com/1Panel-dev/1Panel/agent/global"
Expand Down Expand Up @@ -82,8 +83,8 @@ type BackupInfo struct {
}

type FormatCollation struct {
Format string `json:"format" gorm:"column:CHARACTER_SET_NAME"`
Collation string `json:"collation" gorm:"column:COLLATION_NAME"`
Format sql.NullString `json:"format" gorm:"column:CHARACTER_SET_NAME"`
Collation sql.NullString `json:"collation" gorm:"column:COLLATION_NAME"`
}

type RecoverInfo struct {
Expand Down
3 changes: 3 additions & 0 deletions agent/utils/mysql/client/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ func (r *Local) LoadFormatCollation(timeout uint) ([]dto.MysqlFormatCollationOpt
if len(parts) != 2 {
continue
}
if parts[0] == "NULL" {
continue
}
if _, ok := formatMap[parts[0]]; !ok {
formatMap[parts[0]] = []string{parts[1]}
} else {
Expand Down
9 changes: 6 additions & 3 deletions agent/utils/mysql/client/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,13 @@ func (r *Remote) LoadFormatCollation(timeout uint) ([]dto.MysqlFormatCollationOp
if err := rows.Scan(&item.Format, &item.Collation); err != nil {
return nil, err
}
if _, ok := formatMap[item.Format]; !ok {
formatMap[item.Format] = []string{item.Collation}
if !item.Format.Valid {
continue
}
if _, ok := formatMap[item.Format.String]; !ok {
formatMap[item.Format.String] = []string{item.Collation.String}
} else {
formatMap[item.Format] = append(formatMap[item.Format], item.Collation)
formatMap[item.Format.String] = append(formatMap[item.Format.String], item.Collation.String)
}
}
options := []dto.MysqlFormatCollationOption{}
Expand Down
Loading