mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
annotations: removed category stuff, my mistake, we need tags
This commit is contained in:
parent
73718afb79
commit
0bae7212f6
@ -1,39 +0,0 @@
|
||||
package category
|
||||
|
||||
type Repository interface {
|
||||
Save(item *Item) error
|
||||
Update(item *Item) error
|
||||
Delete(params *DeleteParams) error
|
||||
Find(query *FindParams) ([]*Item, error)
|
||||
}
|
||||
|
||||
var repositoryInstance Repository
|
||||
|
||||
func GetRepository() Repository {
|
||||
return repositoryInstance
|
||||
}
|
||||
|
||||
func SetRepository(rep Repository) {
|
||||
repositoryInstance = rep
|
||||
}
|
||||
|
||||
type FindParams struct {
|
||||
OrgId int64 `json:"orgId"`
|
||||
UserId int64 `json:"userId"`
|
||||
Limit int64 `json:"limit"`
|
||||
}
|
||||
|
||||
type DeleteParams struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"title"`
|
||||
}
|
||||
|
||||
type ItemType string
|
||||
|
||||
type Item struct {
|
||||
Id int64 `json:"id"`
|
||||
OrgId int64 `json:"orgId"`
|
||||
UserId int64 `json:"userId"`
|
||||
Name string `json:"title"`
|
||||
Description string `json:"text"`
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/services/category"
|
||||
)
|
||||
|
||||
type SqlCategoryRepo struct {
|
||||
}
|
||||
|
||||
func (r *SqlCategoryRepo) Save(item *category.Item) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SqlCategoryRepo) Update(item *category.Item) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SqlCategoryRepo) Delete(params *category.DeleteParams) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *SqlCategoryRepo) Find(params *category.FindParams) ([]*category.Item, error) {
|
||||
return nil, nil
|
||||
}
|
@ -35,7 +35,6 @@ func addAnnotationMig(mg *Migrator) {
|
||||
}
|
||||
|
||||
mg.AddMigration("Drop old annotation table v4", NewDropTableMigration("annotation"))
|
||||
|
||||
mg.AddMigration("create annotation table v5", NewAddTableMigration(table))
|
||||
|
||||
// create indices
|
||||
|
@ -1,27 +0,0 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
)
|
||||
|
||||
func addAnnotationCategoryMig(mg *Migrator) {
|
||||
category := Table{
|
||||
Name: "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},
|
||||
{Name: "description", Type: DB_Text, Nullable: false},
|
||||
},
|
||||
Indices: []*Index{
|
||||
{Cols: []string{"org_id", "name"}, Type: IndexType},
|
||||
},
|
||||
}
|
||||
|
||||
// create table
|
||||
mg.AddMigration("create category table", NewAddTableMigration(category))
|
||||
|
||||
// create indices
|
||||
mg.AddMigration("add index org_id & name", NewAddIndexMigration(category, category.Indices[0]))
|
||||
}
|
@ -26,7 +26,6 @@ func AddMigrations(mg *Migrator) {
|
||||
addAnnotationMig(mg)
|
||||
addStatsMigrations(mg)
|
||||
addTestDataMigrations(mg)
|
||||
// addAnnotationCategoryMig(mg)
|
||||
}
|
||||
|
||||
func addMigrationLogMigrations(mg *Migrator) {
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/log"
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/annotations"
|
||||
"github.com/grafana/grafana/pkg/services/category"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
@ -101,8 +100,6 @@ func SetEngine(engine *xorm.Engine) (err error) {
|
||||
|
||||
// Init repo instances
|
||||
annotations.SetRepository(&SqlAnnotationRepo{})
|
||||
category.SetRepository(&SqlCategoryRepo{})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user