Alerting: Add clean_upgrade config and deprecate force_migration (#78324)

* Alerting: Add clean_upgrade config and deprecate force_migration

Upgrading to UA and rolling back will no longer delete any data by default. 
Instead, each set of tables will remain unchanged when switching between 
legacy and UA. As such, the force_migration config has been deprecated 
and no extra configuration is required to roll back to legacy anymore.

If clean_upgrade is set to true when upgrading from legacy alerting to Unified
Alerting, grafana will first delete all existing Unified Alerting resources,
thus re-upgrading all organizations from scratch. If false or unset,
organizations that have previously upgraded will not lose their existing Unified
 Alerting data when switching between legacy and Unified Alerting.

 Similar to force_migration, it should be kept false when not needed as it may
 cause unintended data-loss if left enabled.

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
Matthew Jacobson
2023-11-30 11:01:11 -05:00
committed by GitHub
co-authored by Christopher Moyer
parent 0f0249abea
commit 5a80962de9
9 changed files with 144 additions and 47 deletions
+2
View File
@@ -416,6 +416,7 @@ type Cfg struct {
StackID string
Slug string
// Deprecated
ForceMigration bool
// Analytics
@@ -1061,6 +1062,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
cfg.Env = Env
cfg.StackID = valueAsString(iniFile.Section("environment"), "stack_id", "")
cfg.Slug = valueAsString(iniFile.Section("environment"), "stack_slug", "")
//nolint:staticcheck
cfg.ForceMigration = iniFile.Section("").Key("force_migration").MustBool(false)
InstanceName = valueAsString(iniFile.Section(""), "instance_name", "unknown_instance_name")
plugins := valueAsString(iniFile.Section("paths"), "plugins", "")