feat(alerting): add basic tables for alerting definitions

This commit is contained in:
bergquist
2016-04-13 10:33:45 +02:00
parent 6b8921c8c5
commit 91a1a823e2
5 changed files with 119 additions and 0 deletions
@@ -0,0 +1,27 @@
package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addAlertMigrations(mg *Migrator) {
mg.AddMigration("Drop old table alert table", NewDropTableMigration("alert"))
alertV1 := Table{
Name: "alert",
Columns: []*Column{
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
{Name: "dashboard_id", Type: DB_BigInt, Nullable: false},
{Name: "panel_id", Type: DB_BigInt, Nullable: false},
{Name: "query", Type: DB_Text, Nullable: false},
{Name: "query_ref_id", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "warn_level", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "error_level", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "check_interval", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "title", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "description", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "query_range", Type: DB_NVarchar, Length: 255, Nullable: false},
},
}
// create table
mg.AddMigration("create alert table v1", NewAddTableMigration(alertV1))
}
@@ -22,6 +22,7 @@ func AddMigrations(mg *Migrator) {
addSessionMigration(mg)
addPlaylistMigrations(mg)
addPreferencesMigrations(mg)
addAlertMigrations(mg)
}
func addMigrationLogMigrations(mg *Migrator) {