Live: Remove dev code that would save config and messages in SQL (#62912)
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
@@ -107,12 +107,6 @@ var exporters = []Exporter{
|
||||
Description: "saved links",
|
||||
process: exportSystemShortURL,
|
||||
},
|
||||
{
|
||||
Key: "system_live",
|
||||
Name: "Grafana live",
|
||||
Description: "archived messages",
|
||||
process: exportLive,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user