1 parent
f2703f16d5
commit
52f42616a2
24 files changed
+150
-85
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
@@ -20,7 +21,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
err := db.Debug().Migrator().AutoMigrate(
|
||||
new(models.CasbinRule),
|
||||
new(models.SysDept),
|
||||
new(models.SysConfig),
|
||||
new(system.SysConfig),
|
||||
new(tools.SysTables),
|
||||
new(tools.SysColumns),
|
||||
new(models.Menu),
|
||||
@@ -34,7 +35,7 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
new(models.DictData),
|
||||
new(models.DictType),
|
||||
new(models.SysJob),
|
||||
new(models.SysConfig),
|
||||
new(system.SysConfig),
|
||||
new(models.SysSetting),
|
||||
new(models.SysFileDir),
|
||||
new(models.SysFileInfo),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@@ -260,7 +261,7 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
{DeptId: 10, ParentId: 1, DeptPath: "/0/1/10", DeptName: "人力资源", Sort: 3, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "1", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
}
|
||||
|
||||
list4 := []models.SysConfig{
|
||||
list4 := []system.SysConfig{
|
||||
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-默认皮肤样式名称", ConfigKey: "sys_index_skinName", ConfigValue: "skin-blue", ConfigType: "Y", Remark: "蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow"},
|
||||
{Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "用户管理-账号初始密码", ConfigKey: "sys.user.initPassword", ConfigValue: "123456", ConfigType: "Y", Remark: "初始化密码 123456"},
|
||||
{Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now(), DeletedAt: gorm.DeletedAt{}}, ControlBy: common.ControlBy{CreateBy: 1, UpdateBy: 1}, ConfigName: "主框架页-侧边栏主题", ConfigKey: "sys_index_sideTheme", ConfigValue: "theme-dark", ConfigType: "Y", Remark: "深色主题theme-dark,浅色主题theme-light"},
|
||||
|
||||
@@ -2,6 +2,7 @@ package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
@@ -16,14 +17,16 @@ func init() {
|
||||
|
||||
func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
if tx.Migrator().HasColumn(&system.SysConfig{}, "config_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
list2 := []models.CasbinRule{
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"},
|
||||
}
|
||||
err = tx.Create(list2).Error
|
||||
err := tx.Create(list2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -34,7 +37,7 @@ func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return db.Create(&common.Migration{
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user