Live: Remove dev code that would save config and messages in SQL (#62912)

This commit is contained in:
Ryan McKinley
2023-02-03 16:21:48 -05:00
committed by GitHub
parent 84a6671911
commit 72790b0614
10 changed files with 0 additions and 113 deletions
-50
View File
@@ -1,50 +0,0 @@
package export
import (
"fmt"
"path"
"time"
"github.com/grafana/grafana/pkg/infra/db"
)
func exportLive(helper *commitHelper, job *gitExportJob) error {
messagedir := path.Join(helper.orgDir, "system", "live", "message")
return job.sql.WithDbSession(helper.ctx, func(sess *db.Session) error {
type msgResult struct {
Channel string `xorm:"channel"`
Data string `xorm:"data"`
CreatedBy int64 `xorm:"created_by"`
Created time.Time `xorm:"created"`
}
rows := make([]*msgResult, 0)
sess.Table("live_message").Where("org_id = ?", helper.orgID)
err := sess.Find(&rows)
if err != nil {
if isTableNotExistsError(err) {
return nil
}
return err
}
for _, row := range rows {
err = helper.add(commitOptions{
body: []commitBody{{
body: []byte(row.Data),
fpath: path.Join(messagedir, row.Channel) + ".json", // must be JSON files
}},
comment: fmt.Sprintf("Exporting: %s", row.Channel),
when: row.Created,
userID: row.CreatedBy,
})
if err != nil {
return err
}
}
return err
})
}
-6
View File
@@ -107,12 +107,6 @@ var exporters = []Exporter{
Description: "saved links",
process: exportSystemShortURL,
},
{
Key: "system_live",
Name: "Grafana live",
Description: "archived messages",
process: exportLive,
},
},
},
{