feat provider-article添加AutoMrigate

This commit is contained in:
timerzz 2024-08-30 13:29:39 +08:00
parent a6be6c7cba
commit 55f4cbdd6b
2 changed files with 10 additions and 0 deletions

View File

@ -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{})
}

View File

@ -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{})
}