mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(stacks): migrate stack data from previous portainer version
This commit is contained in:
parent
5e73a49473
commit
e1345416b4
7 changed files with 81 additions and 17 deletions
|
@ -1,5 +1,7 @@
|
|||
package bolt
|
||||
|
||||
import "github.com/portainer/portainer"
|
||||
|
||||
func (m *Migrator) updateEndpointsToVersion12() error {
|
||||
legacyEndpoints, err := m.EndpointService.Endpoints()
|
||||
if err != nil {
|
||||
|
@ -35,3 +37,21 @@ func (m *Migrator) updateEndpointGroupsToVersion12() error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Migrator) updateStacksToVersion12() error {
|
||||
legacyStacks, err := m.StackService.Stacks()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, stack := range legacyStacks {
|
||||
stack.Type = portainer.DockerSwarmStack
|
||||
|
||||
err = m.StackService.UpdateStack(stack.ID, &stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue