refactor🎨:补充初始化数据
This commit is contained in:
1 parent
7699d8cf42
commit
992d892523
1 file changed
+6
-1
@@ -16,7 +16,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _1599190683659Tables(db *gorm.DB, version string) error {
|
func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||||
err := db.Debug().Migrator().AutoMigrate(
|
return db.Transaction(func(tx *gorm.DB) error {
|
||||||
|
err := tx.Debug().Migrator().AutoMigrate(
|
||||||
new(models.CasbinRule),
|
new(models.CasbinRule),
|
||||||
new(models.SysDept),
|
new(models.SysDept),
|
||||||
new(models.SysConfig),
|
new(models.SysConfig),
|
||||||
@@ -44,8 +45,12 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
|||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
|
if err := models.InitDb(tx); err != nil {
|
||||||
|
|
||||||
}
|
}
|
||||||
return db.Create(&common.Migration{
|
return db.Create(&common.Migration{
|
||||||
Version: version,
|
Version: version,
|
||||||
}).Error
|
}).Error
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user