feat(import): save gnetId for dashbards imported from grafana.net

This commit is contained in:
Torkel Ödegaard
2016-05-27 16:42:32 +02:00
parent c3708b3096
commit 0d4c76a029
4 changed files with 14 additions and 2 deletions
+5
View File
@@ -29,6 +29,7 @@ type Dashboard struct {
Id int64
Slug string
OrgId int64
GnetId int64
Version int
Created time.Time
@@ -77,6 +78,10 @@ func NewDashboardFromJson(data *simplejson.Json) *Dashboard {
dash.Updated = time.Now()
}
if gnetId, err := dash.Data.Get("gnetId").Float64(); err == nil {
dash.GnetId = int64(gnetId)
}
return dash
}
@@ -102,4 +102,9 @@ func addDashboardMigration(mg *Migrator) {
mg.AddMigration("Add column created_by in dashboard - v2", NewAddColumnMigration(dashboardV2, &Column{
Name: "created_by", Type: DB_Int, Nullable: true,
}))
// add column to store gnetId
mg.AddMigration("Add column gnetId in dashboard", NewAddColumnMigration(dashboardV2, &Column{
Name: "gnet_id", Type: DB_BigInt, Nullable: true,
}))
}