alert_mig.go 1.2 KB

12345678910111213141516171819202122232425262728
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addAlertMigrations(mg *Migrator) {
  4. mg.AddMigration("Drop old table alert table", NewDropTableMigration("alert"))
  5. alertV1 := Table{
  6. Name: "alert",
  7. Columns: []*Column{
  8. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  9. {Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
  10. {Name: "panel_id", Type: DB_BigInt, Nullable: false},
  11. {Name: "query", Type: DB_Text, Nullable: false},
  12. {Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false},
  13. {Name: "warn_level", Type: DB_NVarchar, Length: 255, Nullable: false},
  14. {Name: "crit_level", Type: DB_NVarchar, Length: 255, Nullable: false},
  15. {Name: "interval", Type: DB_NVarchar, Length: 255, Nullable: false},
  16. {Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
  17. {Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},
  18. {Name: "query_range", Type: DB_NVarchar, Length: 255, Nullable: false},
  19. {Name: "aggregator", Type: DB_NVarchar, Length: 255, Nullable: false},
  20. },
  21. }
  22. // create table
  23. mg.AddMigration("create alert table v1", NewAddTableMigration(alertV1))
  24. }