fix: Fix the issue of database creation failure (#11057)

This commit is contained in:
ssongliu 2025-11-24 22:35:16 +08:00 committed by GitHub
parent 496c0b50b4
commit e88fe0ac2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 6 additions and 13 deletions

View file

@ -58,7 +58,7 @@ type MysqlDBCreate struct {
From string `json:"from" validate:"required,oneof=local remote"`
Database string `json:"database" validate:"required"`
Format string `json:"format" validate:"required,oneof=utf8mb4 utf8 gbk big5"`
Collation string `json:"collation" validate:"required"`
Collation string `json:"collation"`
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Permission string `json:"permission" validate:"required"`

View file

@ -6,7 +6,7 @@ type DatabaseMysql struct {
From string `json:"from" gorm:"not null;default:local"`
MysqlName string `json:"mysqlName" gorm:"not null"`
Format string `json:"format" gorm:"not null"`
Collation string `json:"collation" gorm:"not null"`
Collation string `json:"collation"`
Username string `json:"username" gorm:"not null"`
Password string `json:"password" gorm:"not null"`
Permission string `json:"permission" gorm:"not null"`

View file

@ -117,10 +117,8 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
return err
}
defer client.Close()
var (
ipams []network.IPAMConfig
enableV6 bool
)
var ipams []network.IPAMConfig
if req.Ipv4 {
var itemIpam network.IPAMConfig
if len(req.AuxAddress) != 0 {
@ -141,7 +139,6 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
ipams = append(ipams, itemIpam)
}
if req.Ipv6 {
enableV6 = true
var itemIpam network.IPAMConfig
if len(req.AuxAddress) != 0 {
itemIpam.AuxAddress = make(map[string]string)
@ -162,7 +159,7 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
}
options := network.CreateOptions{
EnableIPv6: &enableV6,
EnableIPv6: &req.Ipv6,
Driver: req.Driver,
Options: stringsToMap(req.Options),
Labels: stringsToMap(req.Labels),

View file

@ -728,7 +728,7 @@ var AddGPUMonitor = &gormigrate.Migration{
}
var UpdateDatabaseMysql = &gormigrate.Migration{
ID: "20251124-update-database-mysql",
ID: "20251125-update-database-mysql",
Migrate: func(tx *gorm.DB) error {
return tx.AutoMigrate(&model.Database{})
},

View file

@ -192,10 +192,6 @@ const acceptParams = (props: DialogProps): void => {
inspectData.value = props.data;
}
rawJson.value = JSON.stringify(inspectData.value, null, 2);
if (!ports.value.length) {
ports.value = Object.keys(inspectData.value?.Config?.ExposedPorts || {});
}
} catch (e) {
console.error('Failed to parse inspect data:', e);
}