provisioning: avoid caching and use updated field from db

This commit is contained in:
bergquist
2018-02-09 15:23:38 +01:00
parent 31f3fdcba3
commit 59cd2d5102
6 changed files with 20 additions and 127 deletions
@@ -1,8 +1,6 @@
package sqlstore
import (
"time"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
)
@@ -28,6 +26,9 @@ func SaveProvisionedDashboard(cmd *models.SaveProvisionedDashboardCommand) error
}
cmd.Result = cmd.DashboardCmd.Result
if cmd.DashboardProvisioning.Updated.IsZero() {
cmd.DashboardProvisioning.Updated = cmd.Result.Updated
}
return saveProvionedData(sess, cmd.DashboardProvisioning, cmd.Result)
})
@@ -42,7 +43,6 @@ func saveProvionedData(sess *DBSession, cmd *models.DashboardProvisioning, dashb
}
cmd.Id = result.Id
cmd.Updated = time.Now()
cmd.DashboardId = dashboard.Id
if exist {
@@ -183,7 +183,7 @@ func addDashboardMigration(mg *Migrator) {
{Name: "dashboard_id", Type: DB_BigInt, Nullable: true},
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "external_id", Type: DB_Text, Nullable: false},
{Name: "updated", Type: DB_Int, Nullable: false},
{Name: "updated", Type: DB_DateTime, Nullable: false},
},
Indices: []*Index{
{Cols: []string{"dashboard_id"}},