2022-07-17 23:02:14 +00:00
|
|
|
package migrator
|
|
|
|
|
2022-09-16 16:18:44 +00:00
|
|
|
import (
|
|
|
|
portainer "github.com/portainer/portainer/api"
|
2022-07-17 23:02:14 +00:00
|
|
|
|
2022-09-16 16:18:44 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
)
|
2022-07-17 23:02:14 +00:00
|
|
|
|
2022-09-16 16:18:44 +00:00
|
|
|
func (m *Migrator) migrateDBVersionToDB60() error {
|
|
|
|
return m.addGpuInputFieldDB60()
|
2022-07-17 23:02:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Migrator) addGpuInputFieldDB60() error {
|
2022-09-16 16:18:44 +00:00
|
|
|
log.Info().Msg("add gpu input field")
|
|
|
|
|
2022-07-17 23:02:14 +00:00
|
|
|
endpoints, err := m.endpointService.Endpoints()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, endpoint := range endpoints {
|
|
|
|
endpoint.Gpus = []portainer.Pair{}
|
|
|
|
err = m.endpointService.UpdateEndpoint(endpoint.ID, &endpoint)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|