plugin_setting.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addAppSettingsMigration(mg *Migrator) {
  4. pluginSettingTable := Table{
  5. Name: "plugin_setting",
  6. Columns: []*Column{
  7. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  8. {Name: "org_id", Type: DB_BigInt, Nullable: true},
  9. {Name: "plugin_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", "plugin_id"}, Type: UniqueIndex},
  19. },
  20. }
  21. mg.AddMigration("create plugin_setting table", NewAddTableMigration(pluginSettingTable))
  22. //------- indexes ------------------
  23. addTableIndicesMigrations(mg, "v1", pluginSettingTable)
  24. // add column to store installed version
  25. mg.AddMigration("Add column plugin_version to plugin_settings", NewAddColumnMigration(pluginSettingTable, &Column{
  26. Name: "plugin_version", Type: DB_NVarchar, Nullable: true, Length: 50,
  27. }))
  28. }