From 742fc5250a5b956215f81f6cd0598bb9874d72b1 Mon Sep 17 00:00:00 2001 From: timerzz Date: Mon, 26 Aug 2024 17:09:29 +0800 Subject: [PATCH] =?UTF-8?q?feat=20provider=E6=B7=BB=E5=8A=A0AutoMigrate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/provider.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/structs/storage/provider.go b/structs/storage/provider.go index f4987a9..631b7fb 100644 --- a/structs/storage/provider.go +++ b/structs/storage/provider.go @@ -17,6 +17,7 @@ type ProviderApi interface { Create(provider v2.Provider) error Update(provider v2.Provider) error Delete(id uint) (provider v2.Provider, err error) + AutoMigrate() error } func NewProviderApi(db *gorm.DB) ProviderApi { @@ -100,3 +101,7 @@ func (p *providerApi) Delete(id uint) (provider v2.Provider, err error) { }) return } + +func (p *providerApi) AutoMigrate() error { + return p.db.AutoMigrate(&v2.Provider{}, &v2.CalculateProcess{}) +}