fix🐛 :修复初始化Duplicate column name 'is_frontend' (#376)
This commit is contained in:
1 parent
93625a6d9f
commit
547a5eb8e4
5 files changed
+9
-13
No files matched your search
@@ -21,3 +21,4 @@ cmd/migrate/migration/version-local/*
|
|||||||
|
|
||||||
# go sum
|
# go sum
|
||||||
go.sum
|
go.sum
|
||||||
|
config/settings.deva.yml
|
||||||
@@ -21,4 +21,4 @@ func InitMiddleware(r *gin.Engine) {
|
|||||||
r.Use(Secure)
|
r.Use(Secure)
|
||||||
// 链路追踪
|
// 链路追踪
|
||||||
//r.Use(middleware.Trace())
|
//r.Use(middleware.Trace())
|
||||||
}
|
}
|
||||||
@@ -2,18 +2,15 @@ package models
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysChinaAreaData struct {
|
type SysChinaAreaData struct {
|
||||||
models.Model
|
models.Model
|
||||||
models.ControlBy
|
|
||||||
|
|
||||||
PId string `json:"pId" gorm:"type:int(11);comment:上级编码"`
|
PId string `json:"pId" gorm:"type:int(11);comment:上级编码"`
|
||||||
Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
|
Name string `json:"name" gorm:"type:varchar(128);comment:名称"`
|
||||||
CreateTime time.Time `json:"createTime" gorm:"type:timestamp;comment:CreateTime"`
|
models.ControlBy
|
||||||
UpdateTime time.Time `json:"updateTime" gorm:"type:timestamp;comment:UpdateTime"`
|
models.ModelTime
|
||||||
DeleteTime time.Time `json:"deleteTime" gorm:"type:timestamp;comment:DeleteTime"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysChinaAreaData) TableName() string {
|
func (SysChinaAreaData) TableName() string {
|
||||||
@@ -27,4 +24,4 @@ func (e *SysChinaAreaData) Generate() models.ActiveRecord {
|
|||||||
|
|
||||||
func (e *SysChinaAreaData) GetId() interface{} {
|
func (e *SysChinaAreaData) GetId() interface{} {
|
||||||
return e.Id
|
return e.Id
|
||||||
}
|
}
|
||||||
@@ -59,9 +59,6 @@ func (s *SysChinaAreaDataControl) Generate() (*models.SysChinaAreaData, error) {
|
|||||||
Model: common.Model{Id: s.Id},
|
Model: common.Model{Id: s.Id},
|
||||||
PId: s.PId,
|
PId: s.PId,
|
||||||
Name: s.Name,
|
Name: s.Name,
|
||||||
CreateTime: s.CreateTime,
|
|
||||||
UpdateTime: s.UpdateTime,
|
|
||||||
DeleteTime: s.DeleteTime,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,4 +95,4 @@ func (s *SysChinaAreaDataById) Bind(ctx *gin.Context) error {
|
|||||||
|
|
||||||
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
|
func (s *SysChinaAreaDataById) SetUpdateBy(id int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package version
|
|||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go-admin/cmd/migrate/migration"
|
"go-admin/cmd/migrate/migration"
|
||||||
common "go-admin/common/models"
|
common "go-admin/common/models"
|
||||||
@@ -17,7 +18,7 @@ func _1615948084336Test(db *gorm.DB, version string) error {
|
|||||||
return db.Transaction(func(tx *gorm.DB) error {
|
return db.Transaction(func(tx *gorm.DB) error {
|
||||||
|
|
||||||
err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error
|
err := tx.Exec("alter table sys_config add is_frontend int default 1 null comment '是否前台参数' after config_type").Error
|
||||||
if err != nil {
|
if err != nil && !strings.Contains(err.Error(),"Duplicate column name 'is_frontend'") {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,4 +26,4 @@ func _1615948084336Test(db *gorm.DB, version string) error {
|
|||||||
Version: version,
|
Version: version,
|
||||||
}).Error
|
}).Error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user