2015-12-03 23:43:55 +08:00
|
|
|
package migrations
|
|
|
|
|
|
|
|
|
|
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
|
|
|
|
2016-01-10 21:37:11 +01:00
|
|
|
func addAppSettingsMigration(mg *Migrator) {
|
2015-12-03 23:43:55 +08:00
|
|
|
|
2016-01-26 04:18:18 +08:00
|
|
|
appSettingsV2 := Table{
|
2016-01-10 21:37:11 +01:00
|
|
|
Name: "app_settings",
|
2015-12-03 23:43:55 +08:00
|
|
|
Columns: []*Column{
|
|
|
|
|
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
|
|
|
|
{Name: "org_id", Type: DB_BigInt, Nullable: true},
|
2016-01-10 21:37:11 +01:00
|
|
|
{Name: "app_id", Type: DB_NVarchar, Length: 255, Nullable: false},
|
2015-12-03 23:43:55 +08:00
|
|
|
{Name: "enabled", Type: DB_Bool, Nullable: false},
|
2015-12-21 23:09:27 +01:00
|
|
|
{Name: "pinned", Type: DB_Bool, Nullable: false},
|
2015-12-03 23:43:55 +08:00
|
|
|
{Name: "json_data", Type: DB_Text, Nullable: true},
|
2016-01-23 06:17:22 +08:00
|
|
|
{Name: "secure_json_data", Type: DB_Text, Nullable: true},
|
2015-12-03 23:43:55 +08:00
|
|
|
{Name: "created", Type: DB_DateTime, Nullable: false},
|
|
|
|
|
{Name: "updated", Type: DB_DateTime, Nullable: false},
|
|
|
|
|
},
|
|
|
|
|
Indices: []*Index{
|
2016-01-10 21:37:11 +01:00
|
|
|
{Cols: []string{"org_id", "app_id"}, Type: UniqueIndex},
|
2015-12-03 23:43:55 +08:00
|
|
|
},
|
|
|
|
|
}
|
2015-12-22 11:37:44 +01:00
|
|
|
|
2016-01-26 04:18:18 +08:00
|
|
|
mg.AddMigration("Drop old table app_settings v1", NewDropTableMigration("app_settings"))
|
|
|
|
|
|
|
|
|
|
mg.AddMigration("create app_settings table v2", NewAddTableMigration(appSettingsV2))
|
2015-12-03 23:43:55 +08:00
|
|
|
|
|
|
|
|
//------- indexes ------------------
|
2016-01-26 04:24:44 +08:00
|
|
|
addTableIndicesMigrations(mg, "v3", appSettingsV2)
|
2015-12-03 23:43:55 +08:00
|
|
|
}
|