自动初始化整体调试完成

This commit is contained in:
pixel
2021-03-04 19:38:07 +08:00
parent 4a995a1c56
commit 184b1a903f
14 changed files with 273 additions and 32 deletions
+1
View File
@@ -176,6 +176,7 @@ var carbines = []gormadapter.CasbinRule{
//@author: [SliverHorn](https://github.com/SliverHorn)
//@description: casbin_rule 表数据初始化
func (c *casbin) Init() error {
global.GVA_DB.AutoMigrate(gormadapter.CasbinRule{})
return global.GVA_DB.Transaction(func(tx *gorm.DB) error {
if tx.Find(&[]gormadapter.CasbinRule{}).RowsAffected == 154 {
color.Danger.Println("\n[Mysql] --> casbin_rule 表的初始数据已存在!")