feat:add CustomMigrate

This commit is contained in:
zhangwenjian committed 2020-06-28 22:49:42 +08:00
1 parent 4ce39764bc
commit 58999ef1a4
1 file changed
+8
+8
View File
@@ -8,6 +8,7 @@ import (
func AutoMigrate(db *gorm.DB) error {
db.SingularTable(true)
return db.AutoMigrate(
new(models.CasbinRule),
new(tools.SysTables),
@@ -26,3 +27,10 @@ func AutoMigrate(db *gorm.DB) error {
new(models.DictType),
).Error
}
func CustomMigrate(db *gorm.DB,table interface{}) error {
db.SingularTable(true)
return db.AutoMigrate(&table).Error
}