@@ -25,8 +25,7 @@ const (
2525)
2626
2727var (
28- activeConfig = squirrel.Eq {
29- "deleted_at" : nil ,
28+ allConfigs = squirrel.Eq {
3029 "owner_type" : entityType ,
3130 "subsystem" : subsystem ,
3231 }
@@ -124,7 +123,7 @@ func (d DB) GetConfig(userID string) (configs.View, error) {
124123 var cfgBytes []byte
125124 err := d .Select ("id" , "config" ).
126125 From ("configs" ).
127- Where (squirrel.And {activeConfig , squirrel.Eq {"owner_id" : userID }}).
126+ Where (squirrel.And {allConfigs , squirrel.Eq {"owner_id" : userID }}).
128127 OrderBy ("id DESC" ).
129128 Limit (1 ).
130129 QueryRow ().Scan (& cfgView .ID , & cfgBytes )
@@ -150,13 +149,13 @@ func (d DB) SetConfig(userID string, cfg configs.Config) error {
150149
151150// GetAllConfigs gets all of the configs.
152151func (d DB ) GetAllConfigs () (map [string ]configs.View , error ) {
153- return d .findConfigs (activeConfig )
152+ return d .findConfigs (allConfigs )
154153}
155154
156155// GetConfigs gets all of the configs that have changed recently.
157156func (d DB ) GetConfigs (since configs.ID ) (map [string ]configs.View , error ) {
158157 return d .findConfigs (squirrel.And {
159- activeConfig ,
158+ allConfigs ,
160159 squirrel.Gt {"id" : since },
161160 })
162161}
@@ -241,13 +240,13 @@ func (d DB) findRulesConfigs(filter squirrel.Sqlizer) (map[string]configs.Versio
241240
242241// GetAllRulesConfigs gets all alertmanager configs for all users.
243242func (d DB ) GetAllRulesConfigs () (map [string ]configs.VersionedRulesConfig , error ) {
244- return d .findRulesConfigs (activeConfig )
243+ return d .findRulesConfigs (allConfigs )
245244}
246245
247246// GetRulesConfigs gets all the alertmanager configs that have changed since a given config.
248247func (d DB ) GetRulesConfigs (since configs.ID ) (map [string ]configs.VersionedRulesConfig , error ) {
249248 return d .findRulesConfigs (squirrel.And {
250- activeConfig ,
249+ allConfigs ,
251250 squirrel.Gt {"id" : since },
252251 })
253252}
@@ -266,7 +265,6 @@ func (d DB) GetLastConfig(userID string) (configs.View, error) {
266265 return cfgView , err
267266 }
268267 err = json .Unmarshal (cfgBytes , & cfgView .Config )
269- log .Infof ("get last config bytes: %s" , cfgBytes )
270268 return cfgView , err
271269}
272270
@@ -276,8 +274,6 @@ func (d DB) SetDeletedAtConfig(userID string, deletedAt time.Time, cfg configs.C
276274 if err != nil {
277275 return err
278276 }
279-
280- log .Infof ("set deletedA to %s for %s" , deletedAt , cfgBytes )
281277 _ , err = d .Insert ("configs" ).
282278 Columns ("owner_id" , "owner_type" , "subsystem" , "deleted_at" , "config" ).
283279 Values (userID , entityType , subsystem , deletedAt , cfgBytes ).
@@ -294,7 +290,7 @@ func (d DB) DeactivateConfig(userID string) error {
294290 return d .SetDeletedAtConfig (userID , time .Now (), cfg .Config )
295291}
296292
297- // RestoreConfig restores deactivated configuration.
293+ // RestoreConfig restores configuration.
298294func (d DB ) RestoreConfig (userID string ) error {
299295 cfg , err := d .GetLastConfig (userID )
300296 if err != nil {
0 commit comments