From e82ee959edb331ac4021568b985321e460dea0ba Mon Sep 17 00:00:00 2001 From: timerzz Date: Sun, 1 Sep 2024 17:10:18 +0800 Subject: [PATCH] =?UTF-8?q?feat=20ArticleApi=E6=B7=BB=E5=8A=A0AutoMigrate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/article.go | 5 +++++ 1 file changed, 5 insertions(+) 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{}) +}