app_settings.go 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addAppSettingsMigration(mg *Migrator) {
  4. appSettingsV2 := Table{
  5. Name: "app_settings",
  6. Columns: []*Column{
  7. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  8. {Name: "org_id", Type: DB_BigInt, Nullable: true},
  9. {Name: "app_id", Type: DB_NVarchar, Length: 255, Nullable: false},
  10. {Name: "enabled", Type: DB_Bool, Nullable: false},
  11. {Name: "pinned", Type: DB_Bool, Nullable: false},
  12. {Name: "json_data", Type: DB_Text, Nullable: true},
  13. {Name: "secure_json_data", Type: DB_Text, Nullable: true},
  14. {Name: "created", Type: DB_DateTime, Nullable: false},
  15. {Name: "updated", Type: DB_DateTime, Nullable: false},
  16. },
  17. Indices: []*Index{
  18. {Cols: []string{"org_id", "app_id"}, Type: UniqueIndex},
  19. },
  20. }
  21. mg.AddMigration("Drop old table app_settings v1", NewDropTableMigration("app_settings"))
  22. mg.AddMigration("create app_settings table v2", NewAddTableMigration(appSettingsV2))
  23. //------- indexes ------------------
  24. addTableIndicesMigrations(mg, "v3", appSettingsV2)
  25. }