|
|
@@ -1,6 +1,8 @@
|
|
|
package migrations
|
|
|
|
|
|
-import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
|
+import (
|
|
|
+ . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
|
+)
|
|
|
|
|
|
func addDashboardMigration(mg *Migrator) {
|
|
|
var dashboardV1 = Table{
|
|
|
@@ -192,4 +194,26 @@ func addDashboardMigration(mg *Migrator) {
|
|
|
}
|
|
|
|
|
|
mg.AddMigration("create dashboard_provisioning", NewAddTableMigration(dashboardExtrasTable))
|
|
|
+
|
|
|
+ dashboardExtrasTableV2 := Table{
|
|
|
+ Name: "dashboard_provisioning",
|
|
|
+ Columns: []*Column{
|
|
|
+ {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
|
+ {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, Default: "0", Nullable: false},
|
|
|
+ },
|
|
|
+ Indices: []*Index{
|
|
|
+ {Cols: []string{"dashboard_id"}},
|
|
|
+ {Cols: []string{"dashboard_id", "name"}, Type: IndexType},
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ addTableReplaceMigrations(mg, dashboardExtrasTable, dashboardExtrasTableV2, 2, map[string]string{
|
|
|
+ "id": "id",
|
|
|
+ "dashboard_id": "dashboard_id",
|
|
|
+ "name": "name",
|
|
|
+ "external_id": "external_id",
|
|
|
+ })
|
|
|
}
|