mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
graph(create annotation): add initial annotation_category table
This commit is contained in:
parent
2142323da9
commit
ab99a7c1c7
26
pkg/services/sqlstore/migrations/annotation_category_mig.go
Normal file
26
pkg/services/sqlstore/migrations/annotation_category_mig.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addAnnotationCategoryMig(mg *Migrator) {
|
||||||
|
category := Table{
|
||||||
|
Name: "annotation_category",
|
||||||
|
Columns: []*Column{
|
||||||
|
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||||
|
{Name: "org_id", Type: DB_BigInt, Nullable: false},
|
||||||
|
{Name: "user_id", Type: DB_BigInt, Nullable: true},
|
||||||
|
{Name: "name", Type: DB_Text, Nullable: false},
|
||||||
|
},
|
||||||
|
Indices: []*Index{
|
||||||
|
{Cols: []string{"org_id", "name"}, Type: IndexType},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// create table
|
||||||
|
mg.AddMigration("create annotation_category table", NewAddTableMigration(category))
|
||||||
|
|
||||||
|
// create indices
|
||||||
|
mg.AddMigration("add index org_id & name", NewAddIndexMigration(category, category.Indices[0]))
|
||||||
|
}
|
@ -26,6 +26,7 @@ func AddMigrations(mg *Migrator) {
|
|||||||
addAnnotationMig(mg)
|
addAnnotationMig(mg)
|
||||||
addStatsMigrations(mg)
|
addStatsMigrations(mg)
|
||||||
addTestDataMigrations(mg)
|
addTestDataMigrations(mg)
|
||||||
|
// addAnnotationCategoryMig(mg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addMigrationLogMigrations(mg *Migrator) {
|
func addMigrationLogMigrations(mg *Migrator) {
|
||||||
|
Loading…
Reference in New Issue
Block a user