diff --git a/structs/storage/article.go b/structs/storage/article.go index d003701..f5eabbe 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -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{}) +}