* Update config store to split between active and history tables
* Migrations to fix up indexes
* Implement migration from old format to new
* Move add migrations call
* Delete duplicated rows
* Explicitly map fields
* Quote the column name because it's a reserved word
* Lift migrations to top
* Use XORM for nearly everything, avoid any non trivial raw SQL
* Touch up indexes and zero out IDs on move
* Drop TODO that's already completed
* Fix assignment of IDs
// TODO: If we are more structured around how we seed configurations in the future, this can be a pure update instead of upsert. This should improve perf and code clarity.
// UpdateAlertmanagerConfiguration replaces an alertmanager configuration with optimistic locking. It assumes that an existing revision of the configuration exists in the store, and will return an error otherwise.
// Since it's not always consistent as to what state the org ID indexes are in, just drop them all and rebuild from scratch.
// This is not expensive since this table is guaranteed to have a small number of rows.
mg.AddMigration("drop non-unique orgID index on alert_configuration",migrator.NewDropIndexMigration(migrator.Table{Name:"alert_configuration"},&migrator.Index{Cols:[]string{"org_id"}}))
mg.AddMigration("drop unique orgID index on alert_configuration if exists",migrator.NewDropIndexMigration(migrator.Table{Name:"alert_configuration"},&migrator.Index{Type:migrator.UniqueIndex,Cols:[]string{"org_id"}}))
mg.AddMigration("extract alertmanager configuration history to separate table",&extractAlertmanagerConfigurationHistory{})
mg.AddMigration("add unique index on orgID to alert_configuration",migrator.NewAddIndexMigration(migrator.Table{Name:"alert_configuration"},&migrator.Index{Type:migrator.UniqueIndex,Cols:[]string{"org_id"}}))
// extractAMConfigHistoryConfigModel is the model of an alertmanager configuration row, at the time that the extractAlertmanagerConfigurationHistory migration was run.
// This is not to be used outside of the extractAlertmanagerConfigurationHistory migration.