feat ArticleApi添加AutoMigrate

This commit is contained in:
timerzz 2024-09-01 17:10:18 +08:00
parent 14abeb24b5
commit e82ee959ed

View File

@ -11,6 +11,7 @@ type ArticleApi interface {
Find(query *FindArticleQuery) (articles []v2.Article, err error)
List(query PageListQuery) (articles []v2.Article, total int64, err error)
Get(query *GetArticleQuery) (article v2.Article, err error)
AutoMigrate() error
}
type articleApi struct {
@ -150,3 +151,7 @@ func (a *articleApi) Get(query *GetArticleQuery) (article v2.Article, err error)
err = a.db.Scopes(query.Scope).First(&article).Error
return
}
func (a *articleApi) AutoMigrate() error {
return a.db.AutoMigrate(&v2.Article{})
}