migrate.go
598 字节
package db
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
"gorm.io/gorm"
)
func Migrate(db *gorm.DB) {
modelsList := []interface{}{
&models.Article{},
&models.ArticleSection{},
&models.ArticleBackup{},
&models.ArticleDraft{},
&models.ArticleComment{},
&models.ArticleTag{},
&models.UserLoveFlag{},
&models.UserReadArticle{},
&models.User{},
&models.Role{},
&models.Company{},
&models.UserFollow{},
&models.MessageSystem{},
&models.MessageBusiness{},
&models.Department{},
}
db.AutoMigrate(modelsList...)
}