From 55f4cbdd6b2c47304205e76604bd16065f10429c Mon Sep 17 00:00:00 2001 From: timerzz Date: Fri, 30 Aug 2024 13:29:39 +0800 Subject: [PATCH] =?UTF-8?q?feat=20provider-article=E6=B7=BB=E5=8A=A0AutoMr?= =?UTF-8?q?igate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/provider-article.go | 5 +++++ structs/storage/seller-article.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/structs/storage/provider-article.go b/structs/storage/provider-article.go index 4b52629..edd065d 100644 --- a/structs/storage/provider-article.go +++ b/structs/storage/provider-article.go @@ -10,6 +10,7 @@ import ( type ProviderArticleApi interface { Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error) Upsert(article v2.ProviderArticle) error + AutoMigrate() error } type providerArticleApi struct { @@ -58,3 +59,7 @@ func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error { DoUpdates: clause.AssignmentColumns([]string{"cost"}), }).Create(&article).Error } + +func (p *providerArticleApi) AutoMigrate() error { + return p.db.AutoMigrate(&v2.ProviderArticle{}) +} diff --git a/structs/storage/seller-article.go b/structs/storage/seller-article.go index b4ae2cf..aaf542f 100644 --- a/structs/storage/seller-article.go +++ b/structs/storage/seller-article.go @@ -10,6 +10,7 @@ import ( type SellerArticleApi interface { Get(query GetProviderArticleQuery) (article v2.ProviderArticle, err error) Upsert(article v2.SellerArticle) error + AutoMigrate() error } type sellerArticleApi struct { @@ -54,3 +55,7 @@ func (p *sellerArticleApi) Upsert(article v2.SellerArticle) error { DoUpdates: clause.AssignmentColumns([]string{"sell"}), }).Create(&article).Error } + +func (p *sellerArticleApi) AutoMigrate() error { + return p.db.AutoMigrate(&v2.SellerArticle{}) +}