feat(api/bolt): update DBVersion to 25

pull/4098/head
Anthony Lapenna 4 years ago
parent 3953acf110
commit e78aaec558

@ -1,20 +1,6 @@
package migrator package migrator
import (
"github.com/portainer/portainer/api"
)
func (m *Migrator) updateSettingsToDB24() error { func (m *Migrator) updateSettingsToDB24() error {
legacySettings, err := m.settingsService.Settings() // Placeholder for 1.24.1 backports
if err != nil { return nil
return err
}
if legacySettings.TemplatesURL == "" {
legacySettings.TemplatesURL = portainer.DefaultTemplatesURL
}
legacySettings.UserSessionTimeout = portainer.DefaultUserSessionTimeout
return m.settingsService.UpdateSettings(legacySettings)
} }

@ -0,0 +1,20 @@
package migrator
import (
"github.com/portainer/portainer/api"
)
func (m *Migrator) updateSettingsToDB25() error {
legacySettings, err := m.settingsService.Settings()
if err != nil {
return err
}
if legacySettings.TemplatesURL == "" {
legacySettings.TemplatesURL = portainer.DefaultTemplatesURL
}
legacySettings.UserSessionTimeout = portainer.DefaultUserSessionTimeout
return m.settingsService.UpdateSettings(legacySettings)
}

@ -321,7 +321,7 @@ func (m *Migrator) Migrate() error {
} }
} }
// Portainer 2.0 // Portainer 1.24.1
if m.currentDBVersion < 24 { if m.currentDBVersion < 24 {
err := m.updateSettingsToDB24() err := m.updateSettingsToDB24()
if err != nil { if err != nil {
@ -329,5 +329,13 @@ func (m *Migrator) Migrate() error {
} }
} }
// Portainer 2.0
if m.currentDBVersion < 25 {
err := m.updateSettingsToDB25()
if err != nil {
return err
}
}
return m.versionService.StoreDBVersion(portainer.DBVersion) return m.versionService.StoreDBVersion(portainer.DBVersion)
} }

@ -1118,7 +1118,7 @@ const (
// APIVersion is the version number of the Portainer API // APIVersion is the version number of the Portainer API
APIVersion = "2.0.0-dev" APIVersion = "2.0.0-dev"
// DBVersion is the version number of the Portainer database // DBVersion is the version number of the Portainer database
DBVersion = 24 DBVersion = 25
// AssetsServerURL represents the URL of the Portainer asset server // AssetsServerURL represents the URL of the Portainer asset server
AssetsServerURL = "https://portainer-io-assets.sfo2.digitaloceanspaces.com" AssetsServerURL = "https://portainer-io-assets.sfo2.digitaloceanspaces.com"
// MessageOfTheDayURL represents the URL where Portainer MOTD message can be retrieved // MessageOfTheDayURL represents the URL where Portainer MOTD message can be retrieved

Loading…
Cancel
Save