mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-17 21:08:25 +08:00
fix: Fix the issue of database creation failure (#11057)
This commit is contained in:
parent
496c0b50b4
commit
e88fe0ac2f
5 changed files with 6 additions and 13 deletions
|
|
@ -58,7 +58,7 @@ type MysqlDBCreate struct {
|
||||||
From string `json:"from" validate:"required,oneof=local remote"`
|
From string `json:"from" validate:"required,oneof=local remote"`
|
||||||
Database string `json:"database" validate:"required"`
|
Database string `json:"database" validate:"required"`
|
||||||
Format string `json:"format" validate:"required,oneof=utf8mb4 utf8 gbk big5"`
|
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"`
|
Username string `json:"username" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password" validate:"required"`
|
||||||
Permission string `json:"permission" validate:"required"`
|
Permission string `json:"permission" validate:"required"`
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ type DatabaseMysql struct {
|
||||||
From string `json:"from" gorm:"not null;default:local"`
|
From string `json:"from" gorm:"not null;default:local"`
|
||||||
MysqlName string `json:"mysqlName" gorm:"not null"`
|
MysqlName string `json:"mysqlName" gorm:"not null"`
|
||||||
Format string `json:"format" 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"`
|
Username string `json:"username" gorm:"not null"`
|
||||||
Password string `json:"password" gorm:"not null"`
|
Password string `json:"password" gorm:"not null"`
|
||||||
Permission string `json:"permission" gorm:"not null"`
|
Permission string `json:"permission" gorm:"not null"`
|
||||||
|
|
|
||||||
|
|
@ -117,10 +117,8 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer client.Close()
|
||||||
var (
|
var ipams []network.IPAMConfig
|
||||||
ipams []network.IPAMConfig
|
|
||||||
enableV6 bool
|
|
||||||
)
|
|
||||||
if req.Ipv4 {
|
if req.Ipv4 {
|
||||||
var itemIpam network.IPAMConfig
|
var itemIpam network.IPAMConfig
|
||||||
if len(req.AuxAddress) != 0 {
|
if len(req.AuxAddress) != 0 {
|
||||||
|
|
@ -141,7 +139,6 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
|
||||||
ipams = append(ipams, itemIpam)
|
ipams = append(ipams, itemIpam)
|
||||||
}
|
}
|
||||||
if req.Ipv6 {
|
if req.Ipv6 {
|
||||||
enableV6 = true
|
|
||||||
var itemIpam network.IPAMConfig
|
var itemIpam network.IPAMConfig
|
||||||
if len(req.AuxAddress) != 0 {
|
if len(req.AuxAddress) != 0 {
|
||||||
itemIpam.AuxAddress = make(map[string]string)
|
itemIpam.AuxAddress = make(map[string]string)
|
||||||
|
|
@ -162,7 +159,7 @@ func (u *ContainerService) CreateNetwork(req dto.NetworkCreate) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
options := network.CreateOptions{
|
options := network.CreateOptions{
|
||||||
EnableIPv6: &enableV6,
|
EnableIPv6: &req.Ipv6,
|
||||||
Driver: req.Driver,
|
Driver: req.Driver,
|
||||||
Options: stringsToMap(req.Options),
|
Options: stringsToMap(req.Options),
|
||||||
Labels: stringsToMap(req.Labels),
|
Labels: stringsToMap(req.Labels),
|
||||||
|
|
|
||||||
|
|
@ -728,7 +728,7 @@ var AddGPUMonitor = &gormigrate.Migration{
|
||||||
}
|
}
|
||||||
|
|
||||||
var UpdateDatabaseMysql = &gormigrate.Migration{
|
var UpdateDatabaseMysql = &gormigrate.Migration{
|
||||||
ID: "20251124-update-database-mysql",
|
ID: "20251125-update-database-mysql",
|
||||||
Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
return tx.AutoMigrate(&model.Database{})
|
return tx.AutoMigrate(&model.Database{})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -192,10 +192,6 @@ const acceptParams = (props: DialogProps): void => {
|
||||||
inspectData.value = props.data;
|
inspectData.value = props.data;
|
||||||
}
|
}
|
||||||
rawJson.value = JSON.stringify(inspectData.value, null, 2);
|
rawJson.value = JSON.stringify(inspectData.value, null, 2);
|
||||||
|
|
||||||
if (!ports.value.length) {
|
|
||||||
ports.value = Object.keys(inspectData.value?.Config?.ExposedPorts || {});
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to parse inspect data:', e);
|
console.error('Failed to parse inspect data:', e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue